1.eval
2.json
# NameError: name
# 'null' is not defined
# i_dict=eval(i)
这种方式,如果dict字符串中有null ,将不能变成dict
i_dict = json.loads(i)
#将str类型转化为dict policy = json.loads(p) #将dict类型转化为str p = json.dumps(policy)
1.eval
2.json
# NameError: name
# 'null' is not defined
# i_dict=eval(i)
这种方式,如果dict字符串中有null ,将不能变成dict
i_dict = json.loads(i)
#将str类型转化为dict policy = json.loads(p) #将dict类型转化为str p = json.dumps(policy)