configobj - use of

Bruce epost2 at gmail.com
Thu May 24 09:15:23 EDT 2007


I assume that you know the module configobj. I use it like this:
I have a config_file :

[sec1]
[[subsec1]]
a = 1
b = 2
[[subsec2]]
a = 3
b = 1

.. ans so on

Then in the code I have c = configobj.ConfigObj(path_to_config file)

then I go like for instance

for s in c['sec1']:
	print c['sec1'][s]['a']

Just think its awkward that its neccessary to use the c['sec1'] again
inside the loop,
guess I`d like it to be like
print s.a

instead

Is this the right way to use configobj?




More information about the Python-list mailing list