ConfigParser options spanning more than one line
narshe at gmail.com
Mon Aug 16 20:57:30 CEST 2004
That works, I guess I'll just have to remove the \n from the variable then.
On Mon, 16 Aug 2004 13:31:03 -0500, Paramjit Oberoi
<p_s_oberoi at hotmail.com> wrote:
> > I'm using ConfigParser and I can't seem to get a config option to span
> > more than one line.
> >>> from ConfigParser import ConfigParser
> >>> from StringIO import StringIO
> >>> s = StringIO("[a]\n"
> .... "b = 123\n"
> .... " 456")
> >>> c=ConfigParser()
> >>> c.readfp(s)
> >>> c.get('a','b')
> In other words, any line with a leading whitespace is considered a
> continuation line, and the leading whitespace is stripped from the value
> (but the carriage return is left in).
More information about the Python-list