存储json文件
import json
with open('ysy_accruacy_threshold.json', 'w', encoding='utf-8') as f:
json.dump(at, f, indent=4)
with open("stq_to_ans.json","w",encoding="utf-8") as f:
t = json.dumps(jjj,indent=4,ensure_ascii=False)
f.write(t)
打开json文件
import json
with open("stq_to_ans.json", 'r', encoding='utf-8-sig') as stq_to_ans: # 加载 QA对
QA_json = json.load(stq_to_ans)