使用ConfigParser时发现在sections下面的options不会区分大小写,原因为ConfigParser设置默认为识别小写,自己从新改下
optionxform即可
class MyConfigParser(ConfigParser.ConfigParser):
"""
set ConfigParser options for case sensitive.
"""
def __init__(self, defaults=None):
ConfigParser.ConfigParser.__init__(self, defaults=defaults)
def optionxform(self, optionstr):
return optionstr