[Tutor] Saving information for my program

Marc Tompkins marc.tompkins at gmail.com
Mon Mar 21 20:06:46 CET 2011

On Mon, Mar 21, 2011 at 8:11 AM, michael scott <jigenbakuda at yahoo.com>wrote:

> How do I save user created information in python?

As others have mentioned, SQL support is bundled with Python.  If your
collection of people and their attributes is expected to grow much, that
would definitely be how I'd go.

However, there's another time-tested option: the config or INI file.  Even
if you store your data in an SQL database, you might want to keep the
connection parameters (how your program talks to that database) in a
human-readable format... I also like to keep user preferences (size/location
of main window, favorite printer, whatever) in an INI file (I know this
isn't universal, but it's how I like to do it - I dabbled in XML config
files, but the signal/noise ratio is way too low.)

Python comes with the ConfigParser module:

and Michael Foord has an excellent upgrade called ConfigObj:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110321/4a4eb602/attachment.html>

More information about the Tutor mailing list