class MyParser(ConfigParser.ConfigParser):

    def as_dict(self):
        d = dict(self._sections)
for k in d:
    d[k] = dict(self._defaults, **d[k])
d[k].pop('__name__', None)
return d
Read all the contents in ini file into dictionary with Python