[Tutor] saving program

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Thu Sep 2 07:42:01 CEST 2004


[some text cut]

> It [saving program state] can be a very complex thing, and it depends
> alot on how you structure the solution.  If i where to do it I would
> serilize(persist) objects.  However there are just tons of ways to do
> this.

Hi Jason,

Python comes with a Standard Library module called 'shelve' that acts like
a dictionary, but is actually backed by a disk:

    http://www.python.org/doc/lib/module-shelve.html

There are other serialization systems available, but for simple things,
'shelve' seems to be a nice way to save the state of your program.  Try
'shelve' out; if you have questions, please feel free to bring them up.


Good luck!



More information about the Tutor mailing list