editing conf file

Thomas Bach thbach at students.uni-mainz.de
Fri Nov 16 14:04:12 CET 2012

On Fri, Nov 16, 2012 at 01:48:49PM +0100, chip9munk wrote:
> configparser has four functions: get, getboolean, getfloat and getint.
> how do I get list from cfg file?!

AFAIK you have to parse the list yourself. Something like

my_list = [ s.strip() for s in cp.get('section', 'option').split(',') ]

if you use a comma as a separator.

Have a look at YAML if this is not enough for you, as I think lists
are supported there. Haven't had a look myself though, yet.

	Thomas Bach.

More information about the Python-list mailing list