editing conf file

chip9munk "chip9munk[SSSpAm" at gmail.com
Fri Nov 16 14:28:33 CET 2012


On 11/16/2012 2:04 PM, Thomas Bach wrote:
> 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.

yes i guess this is needed, thanks!

> 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.
>

I will check it out!

Thank you!




More information about the Python-list mailing list