ID EN
Config Parser

BasicInterpolation

Python 3.11

The default implementation used by ConfigParser. It enables values to contain format strings which refer to other values in the same section, or values in the special default section [1]. Additional default values can be provided on initialization.

Syntax

PYTHON
class configparser.BasicInterpolation

Examples

Example 1
PYTHON
[Paths]
home_dir: /Users
my_dir: %(home_dir)s/lumberjack
my_pictures: %(my_dir)s/Pictures

[Escape]
 use a %% to escape the % sign (% is the only character that needs to be escaped):
gain: 80%%

See Also

ConfigParser ConfigParser