# 5.7 `ConfigParser` -- Configuration file parser.

This module defines the class `ConfigParser`. The `ConfigParser` class implements a basic configuration file parser language which provides a structure similar to what you would find on Microsoft Windows INI files. You can use this to write Python programs which can be customized by end users easily.

The configuration file consists of sections, lead by a "`[section]`" header and followed by "`name: value`" entries, with continuations in the style of RFC 822. The optional values can contain format strings which refer to other values in the same section, or values in a special `DEFAULT` section. Additional defaults can be provided upon initialization and retrieval. Lines beginning with "`#`" are ignored and may be used to provide comments.

For example:

      foodir: %(dir)s/whatever

would resolve the "`%(dir)s`" to the value of dir. All reference expansions are done late, on demand.

Intrinsic defaults can be specified by passing them into the `ConfigParser` constructor as a dictionary. Additional defaults may be passed into the `get` method which will override all others.

`ConfigParser` ([defaults])
  Return a new instance of the `ConfigParser` class. When defaults is given, it is initialized into the dictionairy of intrinsic defaults. They keys must be strings, and the values must be appropriate for the "`%()s`" string interpolation. Note that __name__ is always an intrinsic default; it's value is the section name.

`NoSectionError`
  Exception raised when a specified section is not found.

`DuplicateSectionError`
  Exception raised when mutliple sections with the same name are found.

`NoOptionError`
  Exception raised when a specified option is not found in the specified section.

`InterpolationError`
  Exception raised when problems occur performing string interpolation.

`MissingSectionHeaderError`
  Exception raised when attempting to parse a file which has no section headers.

`ParsingError`
  Exception raised when errors occur attempting to parse a file.

- 5.7.1 ConfigParser Objects