[issue31535] configparser unable to write comment with a upper cas letter

Karthikeyan Singaravelan report at bugs.python.org
Tue Sep 11 07:38:37 EDT 2018


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

Ah my bad again. The config.optionxform = str does the trick. I was using an older object.

from configparser import ConfigParser

config = ConfigParser(allow_no_value=True)
config.optionxform = str
config.add_section('default_settings')
config.set('default_settings', '; comment HERE')

with open('example_case.ini', 'w') as configfile: config.write(configfile)
with open('example_case.ini', 'r') as configfile: print(configfile.read())


Thanks

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31535>
_______________________________________


More information about the Python-bugs-list mailing list