|
From: Nicolas M. <nic...@le...> - 2011-08-29 20:23:35
|
Hehe, not so easy! ;)
This is a subsection only if the key is not only a value but a dictionary :
is_a_subsection = isinstance(config[main_key][key],dict)
if is_a_subsection:
do ...
On 08/29/2011 07:41 PM, Arash Azarmi wrote:
> Hi all ,
> I have 2 questions.
>
>
> 1- I was wondering whats the procedure for reading the value for
> subsection, sub-sub section and so on :
>
> config.cfg file :
>
> [Header]
> User=value
>
> [[ loop]]
> start= startPoint
> step= stepPoint
> stop= stopPoint
>
>
>
> Python Code for reading config file :
>
> config=configObj(path)
> Header = config['Header']
> User = Header['User']
> loop = ??
> step= ???
>
> 2 - how can I have multiple subsections with similar name and keywords
> within one section ?
> For example having multiple [[loop]] subsections like one is defined above .
>
> Thank you ,
> Arash.
>
>
> ------------------------------------------------------------------------------
> EMC VNX: the world's simplest storage, starting under $10K
> The only unified storage solution that offers unified management
> Up to 160% more powerful than alternatives and 25% more efficient.
> Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
>
>
>
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
|