📜  python 将 b 字符串转换为 dict - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:17.180000             🧑  作者: Mango

代码示例1
# python3
import ast
byte_str = b"{'one': 1, 'two': 2}"
dict_str = byte_str.decode("UTF-8")
mydata = ast.literal_eval(dict_str)
print(repr(mydata))