You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
598 B

  1. import configparser
  2. import re
  3. import os.path as osp
  4. # https://stackoverflow.com/a/11866695
  5. CONFIG_PATH = osp.join(osp.dirname(__file__),'config.ini')
  6. class MyParser(configparser.ConfigParser):
  7. def __init__(self):
  8. super().__init__(interpolation = configparser.ExtendedInterpolation())
  9. def getlist(self,section, option,fallback=None):
  10. data = self.get(section,option,fallback=fallback)
  11. if data == fallback:
  12. return data
  13. return list(filter(bool,re.split(' *, *',data)))
  14. config = MyParser()
  15. config.read(CONFIG_PATH)
  16. print(config.getlist('exe','paths'))