|
From: Michael F. <fuz...@vo...> - 2011-11-21 21:29:34
|
On 21/11/2011 21:09, Arash Azarmi wrote:
> Hi all ,
> I am using configObj to store inputs from user.In my case, the
> sequence matters so I can't let the configObj don't store sequence
> order.Both Section and ConfigObj are implemented as ordinary
> dictionary {} . I tried to change that to OrderedDict (from
> collections) but apparently it's not working again.Has anybody a
> solution for this ?
>
ConfigObj does store (and preserve when reading / writing) order.
See the documentation on the "sections" and "scalars" attributes of
sections:
http://www.voidspace.org.uk/python/configobj.html#section-attributes
These attributes are normal lists, representing the order that members,
single values and subsections appear in the section. The order will
either be the order of the original config file, or the order that you
added members.
The order of members in this lists is the order that write creates in
the config file. The scalars list is output before the sections list.
Adding or removing members also alters these lists. You can manipulate
the lists directly to alter the order of members.
All the best,
Michael Foord
> Thanks ,
> Arash.
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure
> contains a definitive record of customers, application performance,
> security threats, fraudulent activity, and more. Splunk takes this
> data and makes sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-novd2d
>
>
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
--
http://www.voidspace.org.uk/
May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html
|