[Tutor] properties

Daniel Yoo dyoo@hkn.EECS.Berkeley.EDU
Sun, 16 Jul 2000 11:17:18 -0700 (PDT)


On Sun, 16 Jul 2000, Isaac wrote:

> Is there a more or less standard way for python progs to store
> configuration options / property sheets (and display them for
> modification by a user?)  Like in a text .ini file, or just writing out
> a Properties dictionary?  I see that pythonwin uses it's interface to
> windows dlls to do it, but what's the more platform independent method?

I haven't personally tried out the ConfigParser module, but it's supposed
to parse out .ini style files.  Here's the link to the reference
documentation:

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

However, this thing only reads in .ini files.  I'm not sure if there's a
module to write your config out, but it might look like a simple loop
through your configuration hashtable:

for k in config.keys():
  file.write("%s: %s\n" % (k, config[k]))