[Tutor] Saving Data
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Tue Dec 30 14:31:47 EST 2003
On Tue, 30 Dec 2003, moore william wrote:
> I am lookign for a tutorial on how to save data created in a program so
> that it can be used when the parogram is started again.
Hi Moore,
What kind of data are you trying to save?
Alan Gauld's tutorial may help: it has a section on file "input/output":
http://www.freenetpages.co.uk/hp/alan.gauld/tutfiles.htm
and that tutorial should give you a better grasp for open()ing,
write()ing, and close()ing files.
You may also find the 'shelve' module useful:
http://www.python.org/doc/lib/module-shelve.html
Shelves act like dictionaries --- except that when we put things into
them, they actually store on disk! So they should allow you to save the
state of your program so that you can restore it later.
If you have more questions on this, please feel free to send another
question on Python-Tutor; we'll be happy to help. Good luck!
More information about the Tutor
mailing list