This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients philippewagnieres@hispeed.ch, xtreak
Date 2018-09-11.11:15:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1536664523.07.0.0269046726804.issue31535@psf.upfronthosting.co.za>
In-reply-to
Content
All config options are converted to lowercase when they are stored. You can customise this with https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.optionxform. You can customize it more with https://docs.python.org/3/library/configparser.html#customizing-parser-behaviour

>  Note also that keys in sections are case-insensitive and stored in lowercase 

>>> from configparser import ConfigParser
>>> c = ConfigParser()
>>> c["A"] = {'FOO': 'bar'}
>>> with open('example.ini', 'w') as configfile: c.write(configfile)
...
>>> with open('example.ini', 'r') as configfile: print(configfile.read())
...
[A]
foo = bar


# Don't convert to lower case

>>> d = ConfigParser()
>>> d.optionxform = str
>>> d["A"] = {'FOO': 'bar'}
>>> with open('example_case.ini', 'w') as configfile: d.write(configfile)
...
>>> with open('example_case.ini', 'r') as configfile: print(configfile.read())
...
[A]
FOO = bar


Hope this answers your question. Feel free to close this if it's clear.

Thanks
History
Date User Action Args
2018-09-11 11:15:23xtreaksetrecipients: + xtreak, philippewagnieres@hispeed.ch
2018-09-11 11:15:23xtreaksetmessageid: <1536664523.07.0.0269046726804.issue31535@psf.upfronthosting.co.za>
2018-09-11 11:15:23xtreaklinkissue31535 messages
2018-09-11 11:15:22xtreakcreate