Parsing files

byrom r.byrom at
Tue Feb 10 14:37:13 CET 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 module which is part of
> Spambayes:
> 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,


More information about the Python-list mailing list