数据存储和读取 发表于 2020-07-23 更新于 2021-06-16 Waline: 阅读次数: 使用json.dump()和json.load()存储数据 1234567import jsonnumbers = [2, 3, 5, 7, 11, 12]filename = "numbers.json"with open(filename, "w") as file_object: json.dump(numbers, file_object) 读取数据1234567import jsonfilename = "numbers.json"with open(filename, "r") as file_object: numbers = json.load(file_object) print(numbers)