from configparser import ConfigParser CONFIG_FILE ='./config.ini' data = ConfigParser() data.read(CONFIG_FILE) config = dict() for section in data.sections(): config[section] = dict() for key, value in data.items(section): config[section][key] = value