xuepangzi

day21课程内容:

   json:

#序列化 把对象(变量)从内存中 编程可存储和可传输的过程 称为序列化
import json
dic={\'name\':\'abc\',\'age\':18}

with open(\'json.txt\',\'w\') as f:
# data=json.dumps(dic)
# f.write(data)
json.dump(dic,f) #等同于上面两句

with open(\'json.txt\',\'r\') as f:
# data=f.read()
# dic1=json.loads(data)
# print(dic)#{\'name\': \'abc\', \'age\': 18}
dic1=json.load(f)
print(dic1) #{\'name\': \'abc\', \'age\': 18}

分类:

技术点:

相关文章:

  • 2021-11-18
  • 2021-10-07
  • 2022-02-02
  • 2021-07-15
  • 2021-08-18
  • 2022-02-22
  • 2021-12-03
  • 2022-03-03
猜你喜欢
  • 2021-12-04
  • 2021-12-24
  • 2022-02-08
  • 2021-09-11
  • 2021-07-13
相关资源
相似解决方案