
key = multiline value with a gotcha this = is still a part of the multiline value of 'key' When set to True, the parser will not allow for any section or optionĭuplicates while reading from a single source (using read_file(), """ ) > print ( parser ) #!/usr/bin/env python # -*- coding: utf-8 -*- > print ( parser ) enabled_extension another_extension yet_another_extension > print ( parser ) if # is not at line start > print ( parser ) line #1 line #2 line #3 interpolation not necessary = if # is not at line start. Syntax, used for instance in zc.buildout. ExtendedInterpolation ¶Īn alternative handler for interpolation which implements a more advanced %(home_dir)s/lumberjack as the value of my_dir.

%(my_dir)s/Pictures as the value of my_pictures and With interpolation set to None, the parser would simply return Specific order in the configuration file. Keys used in the chain of references do not have to be specified in any In the example above, ConfigParser with interpolation set toīasicInterpolation() would resolve %(home_dir)s to the value of home_dir: /Users my_dir: %(home_dir)s/lumberjack my_pictures: %(my_dir)s/Pictures gain: 80%% # use a %% to escape the % sign (% is the only character that needs to be escaped) can_values_be_as_well = True does_that_mean_anything_special = False purpose = formatting for readability multiline_values = are handled just fine as long as they are indented deeper than the first line of a value # Did I mention we can indent comments, too?

# That being said, this can be customized. # Inline comments can be harmful because they prevent users # from using the delimiting characters as parts of values. Key = value spaces in keys = allowed spaces in values = allowed as well spaces around the delimiter = obviously you can also use : to delimit keys from values values like this: 1000000 or this: 3.14159265359 are they treated as numbers? : no integers, floats and booleans are held as: strings can use the API to get converted values directly: true chorus: I'm a lumberjack, and I'm okay I sleep all night and I work all day key_without_value empty string value here = # like this or this # By default only in an empty line.
