Python:使用Pickle保存字典
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python:使用Pickle保存字典相关的知识,希望对你有一定的参考价值。
import pickle zoit = { "Crud": "No", "Fsck": "Blox"} file = open("pickle.pck", "w") # write mode pickle.dump(zoit, file) print "Written to disk. Deleting 'zoit' now." del zoit file.close() del file print "Zoit is now deleted. Reading back from file now:" file = open("pickle.pck", "r") # read mode narf = pickle.load(file) print narf
以上是关于Python:使用Pickle保存字典的主要内容,如果未能解决你的问题,请参考以下文章