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
That is incorrect.
"That is incorrect" means that your statement was wrong. Configuration
files are NOT flat sequences of sections. *Some* configuration files are
flat sequences of sections, some are nested, hierarchical sections, and
some do not have sections at all.
A configuration file is a file containing configuration data. That is
all.
yeah,
organized in [sections]. a flat list of sections.
No, you are making the same wrong statement.
I have hundreds of configuration files on my computer, and very few of
them are a flat list of sections.
That's not an ini file anymore. That's a Foord-file
Who cares? Did the poster say that he needed an INI file? No he did not.
He says he needs a configuration file, and that is *much* more general
than just INI files. Not all configuration files are INI files.
The poster says he needs a list of key:value pairs split into nested
sections. Who cares if that is an INI file or not? It is still a
configuration file, and he can have such a file if he wants.
You might as well complain that his sample config was not valid Python
code. Who cares if it is not valid Python code, he didn't ask for valid
Python code, and he didn't ask for a valid INI file.