Return to Snippet

Revision: 21851
at December 22, 2009 15:17 by magicrebirth


Initial Code
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

Initial URL


Initial Description


Initial Title
Python: using Pickle to save a dictionary

Initial Tags
python

Initial Language
Python