标签:port dump 字符串转换 str pen on() 字典 转换 写入
json.dump()
import json
dict = {‘a‘:1213,‘b‘:[‘ad‘,3,‘23fs‘]}
with open("file_path", "w") as json_f:
json.dump(dict, json_f)
import json()
with open("file_path", "r") as json_f:
dict = json.load(json_f)
import json
dict = {‘a‘:1213,‘b‘:[‘ad‘,3,‘23fs‘]}
dict_str = json.dumps(dict)
import json
dict_str = ‘{‘a‘:1213,‘b‘:[‘ad‘,3,‘23fs‘]}‘
dict = json.loads(dict_str)
标签:port dump 字符串转换 str pen on() 字典 转换 写入
原文地址:https://www.cnblogs.com/liushi-Oscar/p/9577529.html