[Tutor] Saving data to be retrieved later.

Timothy M. Brauch tbrauch@mindless.com
Thu Feb 20 23:20:02 2003


Chris decided to let us know...
>Basically what im trying to do, is save a bunch of statistics to seperate
files, so
>they can be called on later. If you are familiar with muds, i'm trying to
work with
>pfiles. I just thought I would make a single player text based game for my
friends
>and I to play. I have some neat ideas, and I think I know how to implement
them,
>But I will of course need a way to save our characters! :)

Look into 'pickle'.  It allows you to save data to a file and recall it
later, in a special format that preserves data structures.  The other option
I can think of is to use simple open(file).read() and write(), but I think
pickle would probably work better.  I'm not too familiar with using pickle,
though, perhaps once you get started if you have any problems someone else
could better answer some questions.

 - Tim