[Tutor] Saving information for my program

Walter Prins wprins at gmail.com
Mon Mar 21 20:54:22 CET 2011


On 21 March 2011 15:11, michael scott <jigenbakuda at yahoo.com> wrote:

> I was thinking I have 2 options, which is save the information to a text
> file a write / read it in every session, but I have no idea how to do this
> with class attributes. I know how to do it for like a paragraph of text, but
> I have no idea how to do it with classes and their attributes.
>

If you know how to save text, then you should be able to write your own code
to store ("persist") your objects, shouldn't you?  Trying to do so might be
a good learning excercise... ;)

Anyway, I agree with Bob Gailer's advice, and I'd suggest you play around
with several options, learning as you go.  If you design your code
appropriately, you can even start now with e.g. a persistence layer that
uses Pickle (or your own home-brewn save/load code that uses ini file or
text file or whatever), and later move to an SQLite store or even another
relational database engine.

Walter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110321/af52a5b1/attachment.html>


More information about the Tutor mailing list