section with in a section config file and reading that config file

narasimha18sv at gmail.com narasimha18sv at gmail.com
Fri Oct 19 06:22:37 EDT 2012


On Friday, 19 October 2012 15:39:57 UTC+5:30, Tarek Ziadé  wrote:
> On 10/19/12 11:51 AM, kampy wrote:
> 
> > hi all,
> 
> > my requirement is to have section with in a section in config parameters
> 
> > ex:
> 
> > [AAA]
> 
> >      [BBB]
> 
> >       a=1
> 
> >       b=1
> 
> >      [CCC]
> 
> >       a=1
> 
> >       b=2
> 
> > Any one help me in  understanding how to make sure that config file to have a structure like this and reading with the config parser
> 
> a configuration file is a flat sequences of sections, you cannot do this
> 
> 
> 
> what you could do is have 2 files, and add a link from one to the other:
> 
> 
> 
> 
> 
> file1.ini:
> 
> 
> 
>    [AAA]
> 
>    extended = file2.ini
> 
> 
> 
> file2.ini:
> 
> 
> 
>    [BBB]
> 
>    a=1
> 
>    b=1
> 
> 
> 
>    [CCC]
> 
>    a=1
> 
>    b=2
> 
> 
> 
> 
> 
> then create a bit of logic on the top of ConfigParser to read back those 
> 
> values
> 
> 
> 
> HTH
> 
> Tarek

yes but it is not only for one structure like above there will be many sections like that



More information about the Python-list mailing list