lightweight human-readable config?

John Roth newsgroups at jhrothjr.com
Fri Oct 31 10:58:53 EST 2003


"Maxim Khesin" <max at cNvOiSsiPoAnMtech.com> wrote in message
news:1qvob.46881$ri.7441396 at twister.nyc.rr.com...
>
> Nick Vargish wrote:
> > "John Roth" <newsgroups at jhrothjr.com> writes:
> >
> >
> >>for line in inFile.readlines():
> >>    key, value = line.split(":")
> >>    configdict[key] = value
> >
> >
> > for line in inFile.readlines():
> >     key, value = line.split(':', 1)  # only split once, values could
>
> Just one comment: using ':' for separator is not a great idea if Windows
> paths are come of the potential values.

That's why the "1" as the second parameter. It makes sure that
split doesn't do more than one split.

John Roth
> m
>






More information about the Python-list mailing list