ConfigParser: values with ";" and the value blank

André Malo auch-ich-m at g-kein-spam.com
Fri May 5 19:16:26 CEST 2006


* kai wrote:

> I use the ConfigPaserver from Python.
> how can I use/save/read values with ";" (start comment) and the value
> blank?
> When I write (set) my config file often the part behind the ";"
> disappears.
> e.g.
> myKey = startMyValue     ;      endMyValue

You can't. The ConfigParser treats " ;" as inline comment delimiter. This is
undocumented (afaik) and badly hardcoded into the module. The time I found
this out, I simply hacked my own (way more simple) parser module
replacement.

Anyway, you might try http://www.voidspace.org.uk/python/configobj.html
instead. I've never used it myself, though.

nd
-- 
Gib' mal folgendes in die Kommandozeile ein (und einen Moment warten):

net send localhost "Buuuh!"
Na, erschreckt?                              -- Markus Becker in mpdsh



More information about the Python-list mailing list