iniparser
A parser for .ini-syntax files. INIParser should be subclassed to create a data structure from the file. See INIParser for more
The iniparser module is accessible via the initools module.
Classes
C ParseError(...) ...
This class contains 2 members.
C INIParser(...) ...
A parser for .ini-syntax files.
Implements all features I know of in .ini files:
- sections with a [ in the first column
- assignment via a=b or a: b
- rfc822-style continuation lines (i.e., start the next line with indentation to make it a continuation).
- ; or # for comments
This class should be subclassed. Subclasses may only need to implement the .assignment() method. You may want to use the .section attribute, which holds the current section (or None if no section has been defined yet).
Use .parse_error(message) when you encounter a problem; this will create an exception that will note the filename and line in which the problem occurs.
This class contains 18 members.
C BasicParser(...) ...
A simple subclass of INIParser; creates a nested data structure like {'section_name': {'variable': ['values']}}
Usage:
>>> p = BasicParser()
>>> p.load('config.ini')
>>> data = p.data
This class contains 18 members.
See the source for more information.