import ConfigParser # New instance with 'bar' and 'baz' defaulting to 'Life' and 'hard' each config = ConfigParser.SafeConfigParser({'bar': 'Life', 'baz': 'hard'}) config.read('example.cfg')
print config.get('Section1', 'foo') # -> "Python is fun!" config.remove_option('Section1', 'bar') config.remove_option('Section1', 'baz') print config.get('Section1', 'foo') # -> "Life is hard!" -------------- I'm confused. ConfigParser insists that all settings live in some 'section'. At least, settings read from a config file have to have some [section]. What section is associated with the defaults set by the constructor? In the above example, there is no reference to 'Section1' in the constructor, yet we refer to 'Section1' later to retrieve the values? -- http://mail.python.org/mailman/listinfo/python-list