[Baypiggies] Reading k=v format files
Joshua Rodman
jrodman at baypiggies.spamportal.net
Thu Oct 8 15:32:39 CEST 2015
On Sat, Oct 03, 2015 at 01:04:35PM -0700, Ian Zimmerman wrote:
> On 2015-10-03 12:09 -0700, David Berthelot wrote:
>
> > The module ConfigParser in the standard library could be of help since it
> > seems to do exactly this:
> > https://docs.python.org/2/library/configparser.html
>
> Sadly, no.
>
> $ python
...
> ConfigParser.MissingSectionHeaderError: File contains no section
> headers.
Not really batteries-included, but it seems not altogether difficult
to wrangle configparser to do this:
http://stackoverflow.com/questions/2819696/parsing-properties-file-in-python/2819788#2819788
which makes me wonder why it doesn't already handle it.
In my proprietary world, we put stuff outside a section in [default].
(Before anyone asks, last time I sent in a patch fixing a bug in
python it was more painful than I wish to revisit.)
--
If simplicity worked, the world would be overrun with insects
More information about the Baypiggies
mailing list