1 字典转换为json文件
import json
json_str = json.dumps({1:2,2:4})
with open(outjsonpath,'w') as f:
f.write(json_str)
2 json转为字典
import json
dic = json.load(open(jsonpath))
import json
json_str = json.dumps({1:2,2:4})
with open(outjsonpath,'w') as f:
f.write(json_str)
import json
dic = json.load(open(jsonpath))