Normally, I code as follows for getting a particular item in a variable as follows
try: config = ConfigParser.ConfigParser() config.read(self.iniPath
I know that this question was asked 5 years ago, but today I've made this dict comprehension thingy:
parser = ConfigParser() parser.read(filename) confdict = {section: dict(parser.items(section)) for section in parser.sections()}