crazymagic

把json的数据写入到文件中

import json

with open(\'data.json\',\'w+\') as f:

    json.dump({"name":"张彪"},f)

把json的数据从文件中读取出来

import json

with open(\'data.json\',\'r\') as f:
 
    x=json.load(f)
    print(x,type(x))

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2021-11-28
  • 2021-07-03
  • 2021-12-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-27
  • 2021-12-27
  • 2021-05-30
相关资源
相似解决方案