'ConfigParser read Booleans / String / Integer at the same time with Python

Here is my config.ini:

[LOADER]
text = example text
size = 17
settings = None
run = False

But when I print it, using:

config = ConfigParser()
config.read('config.ini')
print(config._sections['LOADER'])

I get this:

{'text': 'example text', 'size': '17', 'settings': 'None', 'run': 'False'}

But I want this:

{'text': 'example text', 'size': 17, 'settings': None, 'run': False}

I tried several methods with ConfigParser, I tried to edit the list to replace the strings in boolean, but I really can't do it, thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source