1. 首页
  2. 数据库
  3. 其它
  4. Python数据的存储和读取 学习笔记

Python数据的存储和读取 学习笔记

上传者: 2020-12-23 01:43:19上传 PDF文件 26.26KB 热度 14次
"""存储数据""" # 使用模块json存储数据 # 防止程序停止运行时用户数据丢失 import json numbers = [2, 3, 4, 5] filename = 'numbers.json' with open(filename, 'w') as f_obj: # 写入模式 json.dump(numbers, f_obj) import json filename = 'numbers.json' with open(filename) as f_obj: # 读取模式 numbers = json.load(f_obj) print(num
下载地址
用户评论