configparser shuffles all sections ?
Stef Mientki
S.Mientki-nospam at mailbox.kun.nl
Fri Jun 22 15:28:18 EDT 2007
Nick Craig-Wood wrote:
> stef <s.mientki at id.umcn.nl> wrote:
>> I just used configparser for the first time and discovered that it
>> shuffled all my sections,
>> and the contents of the sections too.
>>
>> This makes human manipulation of the file impossible.
>>
>> Is there a way to prevent this shuffling,
>
> You could try getting yourself an ordered dictionary implmentation,
> say
>
> http://www.voidspace.org.uk/python/odict.html
>
> Then doing something like this (untested)
>
> class MyConfigParser(SafeConfigParser):
> def __init__(self, defaults=None):
> SafeConfigParser.__init__(defaults)
> self._sections = odict()
> self._defaults = odict()
>
This might be good alternative,
I'll check that.
thank you all for the answers,
it's always good to know that I've not missed the simple solution ;-)
cheers,
Stef Mientki
More information about the Python-list
mailing list