Case Sensitive Section names configparser
Francesco Bochicchio
bieffe62 at gmail.com
Wed Dec 8 05:53:30 EST 2010
On 8 Dic, 11:32, RedBaron <dheeraj.gup... at 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
More information about the Python-list
mailing list