import configparser import re import os.path as osp # https://stackoverflow.com/a/11866695 CONFIG_PATH = osp.join(osp.dirname(__file__),'config.ini') class MyParser(configparser.ConfigParser): def __init__(self): super().__init__(interpolation = configparser.ExtendedInterpolation()) def getlist(self,section, option,fallback=None): data = self.get(section,option,fallback=fallback) if data == fallback: return data return list(filter(bool,re.split(' *, *',data))) config = MyParser() config.read(CONFIG_PATH) print(config.getlist('exe','paths'))