56
56
constructor as a dictionary. Additional defaults may be passed into the
57
57
:meth:`get` method which will override all others.
59
Sections are normally stored in a builtin dictionary. An alternative dictionary
59
Sections are normally stored in a built-in dictionary. An alternative dictionary
60
60
type can be passed to the :class:`ConfigParser` constructor. For example, if a
61
61
dictionary type is passed that sorts its keys, the sections will be sorted on
62
62
write-back, as will be the keys within each section.
318
318
.. method:: RawConfigParser.optionxform(option)
320
Transforms the option name *option* as found in an input file or as passed in by
321
client code to the form that should be used in the internal structures. The
322
default implementation returns a lower-case version of *option*; subclasses may
323
override this or client code can set an attribute of this name on instances to
324
affect this behavior. Setting this to :func:`str`, for example, would make
325
option names case sensitive.
320
Transforms the option name *option* as found in an input file or as passed in
321
by client code to the form that should be used in the internal structures.
322
The default implementation returns a lower-case version of *option*;
323
subclasses may override this or client code can set an attribute of this name
324
on instances to affect this behavior.
326
You don't necessarily need to subclass a ConfigParser to use this method, you
327
can also re-set it on an instance, to a function that takes a string
328
argument. Setting it to ``str``, for example, would make option names case
331
cfgparser = ConfigParser()
333
cfgparser.optionxform = str
335
Note that when reading configuration files, whitespace around the
336
option names are stripped before :meth:`optionxform` is called.
328
339
.. _configparser-objects: