The format of the input is the same as Python (with some extensions). Lists, tuples, dictionaries, floats, integers, strings, and comments are recognized. Triple quoted strings are not recognized. Long integers and complex numbers are not recognized. Numbers are returned as integers if possible. All sequences are returned as lists.
The extensions to the syntax are:
" \t\n#[](){}:="
An example data file using these extensions looks like this:
option1 = 10 option2 = (1 2 3) # some useful commentary subsystem1 = { option1 = 10.102 # a little comment option2 = "This is a quoted string" good_option = on }when parsed the following dictionary is returned:
{'option1': 10, 'subsystem1': {'option1': 10.102, 'good_option': 'on', 'option2': 'This is a quoted string'}, 'option2': [1, 2, 3]}
On a parse error, an LParserError exception is raised. The value of the exception gives the line number and a short description of what when wrong.
Updated: Sun, 09 Apr 2000 15:14:14 -0600
Neil Schemenauer
<nas@arctrix.com>