Question re ConfigParser

alex23 wuwei23 at gmail.com
Wed Aug 20 08:49:30 EDT 2008


On Aug 20, 5:34 pm, loial <jldunn2... at googlemail.com> wrote:
> Given a section like
>
> [Data]
> value1
> value2
> value3
>
> Can ConfigParser be easily used to put the values in a dictionary? If
> so, how?

Dictionaries are key/value pairs. Do you expect 'value1' to be a key
or a value?

If the data is literally as you describe, and not key/value entries
(such as 'key1: value1' or 'key1=value1'), you would probably be
better off just stepping through the file, testing for the [data]
section and then reading the following lines into a list.



More information about the Python-list mailing list