ConfigParser does not substitute
Berthold Hoellmann
hoel at GermanLloyd.org
Wed May 3 06:48:16 EDT 2000
Hello,
Why does ConfigParser does not resolve my references. With the following
config file (samp1.config):
[DEFAULT]
deck=25
[funcel]
DK_1: (group == %(deck)s )
and a small python script called conftest.:
from ConfigParser import ConfigParser
p = ConfigParser()
p.read('samp1.config')
for s in p.sections():
print "section: %s" % s
for o in p.options(s):
print "option for '%s' is '%s' with value '%s'" % (s, o,
p.get(s, o))
print "defaults: ", p.defaults()
I get:
>python conftest.py
section: funcel
option for 'funcel' is 'deck' with value '25'
option for 'funcel' is 'dk_1' with value '(group == %(deck)s )'
option for 'funcel' is '__name__' with value 'funcel'
defaults: {'deck': '25'}
I expected to get
option for 'funcel' is 'dk_1' with value '(group == 25 )'
Why didn't I.
Thanks
Berthold
--
email: hoel at GermanLloyd.org
)
(
C[_] These opinions might be mine, but never those of my employer.
More information about the Python-list
mailing list