Parsing files
byrom
r.byrom at rl.ac.uk
Tue Feb 10 08:37:13 EST 2004
On Tue, 2004-02-10 at 13:33, Skip Montanaro wrote:
> Rob> Does anyone know of a neat way to read-in config files? At the
> Rob> moment I'm using the ConfigParser module but I have to add sections
> Rob> to the config file to make it parseable ie
>
> ...
>
> In what way does the file not parse if the section is not available? If you
> need default values, take a look at the Options.py module which is part of
> Spambayes:
>
> http://cvs.sourceforge.net/viewcvs.py/spambayes/spambayes/spambayes/Options.py?rev=1.104
>
> Skip
thanks, I've taken a look but I'm still unclear as to how the defaults
work. At the moment my config file has no section but when I create a
new ConfigParser it complains that no sections are defined (so the parse
fails). Can I fool the ConfigParser by defining an 'empty' default and
if do you know how?
thanks again,
Rob
More information about the Python-list
mailing list