This is an example of parsing a configuration file with Python standard library.
Example output:
$ python3 configtest.py
Data directory: ~/mydata
Debug mode: True
Error getting the port number: invalid literal for int() with base 10: 'this_is_invalid_number'
More information: https://docs.python.org/3/library/configparser.html