一、将数据保存为.json文件

1 model={} #数据
2 with open("./hmm.json",'w',encoding='utf-8') as json_file:
3         json.dump(model,json_file,ensure_ascii=False)
4   

二、读取.json文件

1 model={} #存放读取的数据
2 with open("./hmm.json",'r',encoding='utf-8') as json_file:
3         model=json.load(json_file)

三、dict数据保存不用转化成json,读取json数据也不能转dict数据

相关文章:

  • 2021-10-11
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2021-09-09
  • 2021-11-16
  • 2021-06-30
  • 2022-02-07
猜你喜欢
  • 2021-08-20
  • 2022-01-01
  • 2022-12-23
  • 2021-06-13
  • 2022-12-23
  • 2021-12-15
  • 2021-05-21
相关资源
相似解决方案