Open this example in the interactive library
Source code
from configparser import ConfigParser
config = ConfigParser()
config.read_string('[app]'+chr(10)+'theme = dark')
print(config['app']['theme'])Sample output
dark

Read an INI section. A self-contained example using the Python standard library.
Open this example in the interactive library
from configparser import ConfigParser
config = ConfigParser()
config.read_string('[app]'+chr(10)+'theme = dark')
print(config['app']['theme'])dark