Case Sensitive Section names configparser
Is there any way by which configParser's get() function can be made case insensitive? -- http://mail.python.org/mailman/listinfo/python-list
Re: Case Sensitive Section names configparser
On 8 Dic, 11:32, RedBaron dheeraj.gup...@gmail.com wrote: Is there any way by which configParser's get() function can be made case insensitive? If you don't care about the case of the config parameter values, you could pre-convert the input to configParser all in UPPER or lower letter with a file-like object like this (NOT TESTED): class AllUpperFile(object): def __init__(self, fname): self.fp = file(fname) def readline(self): return self.fp.readline().upper() and the use configParser.readfp method to feed the file-like object to the config parser myConfigparser.readfp( AllUpperFile(myconnfigfile.cfg) HTH Ciao FB -- http://mail.python.org/mailman/listinfo/python-list
Re: Case Sensitive Section names configparser
On Dec 8, 10:32 am, RedBaron dheeraj.gup...@gmail.com wrote: Is there any way by which configParser's get() function can be made case insensitive? I would probably subclass dict to create a string specific, case insensitive version, and supply it as the dict_type. See http://docs.python.org/library/configparser.html#ConfigParser.RawConfigParser That way your values would remain cased correctly, but lookups would be insensitive. hth Jon. -- http://mail.python.org/mailman/listinfo/python-list