ConfigParser and inifile
volucris at hotmail.com
Thu Jul 12 12:54:46 CEST 2001
"domi" <warp10 at hushmail.com> wrote in message
news:9ijr1q$29sq$1 at news.lf.net...
> Hello All,
> could someone solve this problem?
> I would like to tell ConfigParser to parse an ini-file from one section to
> the other. The ini-file looks like this:
> Now if I let the ConfigParser parse this ini-file like this:
> for section in config.sections():
> ...(do something)
> the parser doesn't step thru section1 to section2 and so on. I need the
> given sequence in the ini-file.
I don't think you can, because the sections are stored in a dictionary,
which is in arbitrary order. You could prefix the section names with numbers
(or letters for that matter). The numbers being in the order you want them
stepped through. So do this instead:
section_list = config.sections()
for section in section_list:
> Thanks, domi
Volucris (a) hotmail.com
"Eu não falo uma única palavra do português."
More information about the Python-list