aszeno

如何进行数据存储,很多程序都要求用户输入某种信息,如让用户存储游戏首选项或提供要可视化的数据。

使用模块json进行数据存储。

1.1、使用json.dump()和json.load()

 

#-*- encoding:utf-8 -*-
import json

numbers = [2,3,5,7,11,13]

filename = \'numbers.json\'
with open(filename,\'w\') as f_obj:
    json.dump(numbers,f_obj)

 

待续........

分类:

技术点:

相关文章:

  • 2022-02-09
  • 2022-01-30
  • 2021-12-12
  • 2022-12-23
  • 2021-10-10
  • 2022-02-13
  • 2022-01-28
  • 2021-12-14
猜你喜欢
  • 2021-11-30
  • 2022-01-16
  • 2022-02-12
  • 2022-01-01
  • 2021-12-25
  • 2022-02-18
  • 2022-01-09
相关资源
相似解决方案