1. python 保存json數(shù)據(jù)
import json
with open('json.txt', 'w+') as json_file:
json.dump(json_data, json_file)
#json_data是需要保存的json數(shù)據(jù)
2. python 讀取文件中的json數(shù)據(jù)
with open('json.txt', 'r+') as json_file:
s = json_file.readlines()
a = json.loads(s)
print(a)