Case Sensitive Section names configparser

R

RedBaron

Is there any way by which configParser's get() function can be made
case insensitive?
 
F

Francesco Bochicchio

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top