import json
json 一种轻量级的数据交换格式。...import json
str_list = "[1, 2, 3, 4]"
str_dict = "{'city': '长沙', 'name': '数据云团'}"
json.loads(str_list...)
>>>[1, 2, 3, 4]
json.loads(str_dict)
>>>{'city': '长沙', 'name': '数据云团'}
?...import json
str_list = [{"city": "长沙"}, {"name": "数据云团"}]
json.dump(str_list, open("listStr.json", "...w"), ensure_ascii=False)
str_dict = {"city": "长沙", "name": "数据云团"}
json.dump(str_dict, open("listStr.json