ConfigParser and options
george young
gry at ll.mit.edu
Thu Feb 13 10:30:57 EST 2003
More information about the Python-list mailing list
Thu Feb 13 10:30:57 EST 2003
- Previous message (by thread): PEP 308: Application needs
- Next message (by thread): ConfigParser and options
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
cepl at surfbest.net (Matej Cepl) wrote in message news:<35993bcb.0302121540.f8d62e2 at posting.google.com>... > I would like to write a config file parser, but I would like to allow > user to > set just some options (when he wants a default values for the rest of > them). How can I do it? > > I can write something like > > for rcvar in rcconfile.options(currsection): > ... > variable = get(currsection,rcvar) > > but how do I connect variable to the real variable which is equal to > the name of the option in the file? Other option is to go in one huge > if ... construct > > if rcconfile.has_key(currsection,'variable1'): > variable1 = rcconfile.get(currsection,'variable1') > if rcconfile.has_key(currsection,'variable2'): > variable2 = rcconfile.get(currsection,'variable2') > if ... Have you looked at the ConfigParser module that comes with python? It might be a good starting place...
- Previous message (by thread): PEP 308: Application needs
- Next message (by thread): ConfigParser and options
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list