Tutorial

First, make sure that typedinterpolation is installed

Use basic typed interpolation

Begin by importing the configparser and the typedinterpolation module:

>>> import configparser
>>> import typedinterpolation

Now, we create a configparser.ConfigParser instance that uses the typedinterpolation.TypedBasicInterpolation.

>>> config = configparser.ConfigParser(interpolation=typedinterpolation.TypedBasicInterpolation())

Let’s test it with parsing a string:

>>> config.read_string("[main]\ntest = 1")
>>> config['main']['test']
1
>>> type(_)
<class 'int'>