source:http://stackoverflow.com/questions/19359556/configparser-reads-capital-keys-and-make-them-lower-case
ConfigParser.ConfigParser()
is a subclass of ConfigParser.RawConfigParser()
, which is documented to behave this way:
All option names are passed through the
optionxform()
method. Its default implementation converts option names to lower case.
That’s because this module parses Windows INI files which are expected to be parsed case-insensitively.
You can disable this behaviour by replacing the RawConfigParser.optionxform()
function:
1 2 | self.config = ConfigParser.ConfigParser() self.config.optionxform = str |
str
passes through the options unchanged.