[Tutor] Writing a Configuration Facility for an Application
w.richert at gmx.net
Fri Jan 30 14:17:34 CET 2009
I have often found that just initializing all the necessary stuff in one
Configuration.py module. You just import it and it works.
If you like the Windows .ini format, ConfigParser is your friend
On Freitag, 30. Januar 2009 13:53:08 Kent Johnson wrote:
> On Fri, Jan 30, 2009 at 7:40 AM, Wayne Watson
> <sierra_mtnview at sbcglobal.net> wrote:
> > I'm about to provide a config file for an application I've been working
> > with.
> > I suspect there may be a standard way of doing this in Python that relies
> > on more complex operations that simplify matters than just reading the
> > file one line at a time. Dictionaries? Comments?
> One possibility is to put the settings in a dictionary and use the
> pickle module to save and restore the dict. This is pretty simple. The
> pickled file is not particularly readable, though.
> Another way is to use a .ini file. The ConfigParser module can read
> ini files but not write them.
> There are add-on modules that implement read-write ini files, for example
> Tutor maillist - Tutor at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor