标签:str dump print code bsp int json ict log
json.dumps : dict转成str
json.loads:str转成dict
dict_ = {1: 2, 3: 4, "55": "66"} print(type(dict_), dict_) #<class ‘dict‘> {‘55‘: ‘66‘, 1: 2, 3: 4} json_str = json.dumps(dict_) print(type(json_str), json_str) #<class ‘str‘> {"55": "66", "1": 2, "3": 4} dict_2 = json.loads(json_str) print(type(dict_2), dict_2) #<class ‘dict‘> {‘55‘: ‘66‘, ‘1‘: 2, ‘3‘: 4}
标签:str dump print code bsp int json ict log
原文地址:http://www.cnblogs.com/xiexiaoxiao/p/7053099.html