5.7.1 ConfigParser Objects

ConfigParser instances have the following methods:

defaults ()
Return a dictionairy containing the instance-wide defaults.

sections ()
Return a list of the sections available; DEFAULT is not included in the list.

add_section (section)
Add a section named section to the instance. If a section by the given name already exists, DuplicateSectionError is raised.

has_section (section)
Indicates whether the named section is present in the configuration. The DEFAULT section is not acknowledged.

options (section)
Returns a list of options available in the specified section.

read (filenames)
Read and parse a list of filenames.

get (section, option[, raw[, vars]])
Get an option value for the provided section. All the "%" interpolations are expanded in the return values, based on the defaults passed into the constructor, as well as the options vars provided, unless the raw argument is true.

getint (section, option)
A convenience method which coerces the option in the specified section to an integer.

getfloat (section, option)
A convenience method which coerces the option in the specified section to a floating point number.

getboolean (section, option)
A convenience method which coerces the option in the specified section to a boolean value. Note that the only accepted values for the option are "0" and "1", any others will raise ValueError.


Send comments on this document to python-docs@python.org.