python如何保存变量

python如何保存变量

 

https://blog.csdn.net/jining11/article/details/81435899

 

 

filename = 'shoplist.data'
# 以二进制写模式打开目标文件
f = open(filename, 'wb')
# 将变量存储到目标文件中区
pickle.dump(r, f)
posted @ 2020-12-26 17:31  bH1pJ  阅读(190)  评论(0编辑  收藏  举报