存储
json.dump:接受两个实参,要储存的数据,以及可用于存储的文件对象
import json
numbers=list(range(100))
filename="my_number.json"
with open(filename,"w") as f:
json.dump(numbers,f)
读取
import json
ilename="my_number.json"
with open(filename,"r")as f:
print(json.load(f))
2023-05-05
网友评论