Help with ConfigParser
tony_ha2002 at yahoo.co.uk
Mon Oct 2 16:29:49 CEST 2006
Thanks for your help, and it works now!
Peter Otten wrote:
> tony.ha at philips.com wrote:
> > Question: How can I pervent ConfigParse to convert Upper case yo lower
> > case??, thanks.
> Transforms the option name option as found in an input file or as passed in
> by client code to the form that should be used in the internal structures.
> The default implementation returns a lower-case version of option;
> subclasses may override this or client code can set an attribute of this
> name on instances to affect this behavior. Setting this to str(), for
> example, would make option names case sensitive.
> If you don't pass defaults:
> config = ConfigParser()
> config.optionxform = str
> # ...
> Or, to be on the safe side:
> class MyCasePreservingConfigParser(ConfigParser):
> optionxform = str
> config = MyCasePreservingConfigParser()
> # ...
More information about the Python-list