I want to set default values for a ConfigParser. So far, its job is
very small, so there is only one section heading, ['Main']. Reading the
docs, I see that in order to set default values in a ConfigParser, you
initialize it with a dictionary or defaults. However, I'm not quite
sure of the syntax to add the section headings in to the dictionary of
defaults. For now, I'm doing it like this:
default_values = {'username' : 'put username here',
'teamnumber': 'team number here',
'update_interval' : 'update interval'}
self.INI = ConfigParser.ConfigParser(default_values)
self.INI.add_section('Main')
This works, but clearly won't last beyond the adding of a second
section. What is the correct way to initialize it with a full
dictionary of defaults, including section names?
Thanks.