An improved version of ConfigParser
A wrapper class for a configuration file parser.
MyConfigParser wraps the ConfigParser.ConfigParser object to add some extra functionality, including getting lists of tuples and automatically writing to the configuration file when values are changed (or when the requested data is not present).
Parameters : | filename : str
optionDefaults : dict
substitutionDefaults : dict
|
---|
Methods
Read a string value for a specified key in a specified section.
Parameters : | section : str
option : str
|
---|---|
Returns : | str :
|
Read a boolean value for a specified key in a specified section.
If the specified key does not exist, it will be added (adding the section, also, if necessary).
Parameters : | section : str
option : str
|
---|---|
Returns : | bool :
|
Read a float value for a specified key in a specified section.
If the specified key does not exist, it will be added (adding the section, also, if necessary).
Parameters : | section : str
option : str
|
---|---|
Returns : | float :
|
Read an integer value for a specified key in a specified section.
If the specified key does not exist, it will be added (adding the section, also, if necessary).
Parameters : | section : str
option : str
|
---|---|
Returns : | int :
|
Read a more complicated structure associated with a specified key.
If the specified key does not exist, it will be added (adding the section, also, if necessary).
Parameters : | section : str
option : str
|
---|---|
Returns : | variable :
|
Set the value of some key, and update the file accordingly.
Parameters : | section : str
option : str
value : variable
addSection : bool
|
---|---|
Returns : | variable :
|
A configuration file parser which automatically loads sections.
Parameters : | filename : str
|
---|
Methods
Return a list of the options within a section.
Parameters : | section : str
|
---|---|
Returns : | list of str :
|
Return a list of the sections in the configuration file.
Returns : | list of str :
|
---|
Return whether the configuration file contains the named section.
Parameters : | section : str
|
---|---|
Returns : | bool :
|
Load the data from a section, converting to the correct types.
Parameters : | section : str
|
---|---|
Returns : | dict :
|
A configuration parser which uses eval and repr to deal with types.
Parameters : | configFile : str
defaults : dict
|
---|
Methods
Return the value associated with the specified option.
Parameters : | section : str
option : str
default : variant
|
---|---|
Returns : | variant :
|
Return a list of options in a section of the configuration file.
Returns : | list of str :
|
---|
Return a list of section names in the configuration file.
Returns : | list of str :
|
---|
Set the value associated with a specified key in a specified section.