[issue19991] configparser instances cannot be pretty printed
Irit Katriel
report at bugs.python.org
Sat Mar 19 16:06:01 EDT 2022
Irit Katriel <iritkatriel at gmail.com> added the comment:
It's not just that it can't be pretty printed - it doesn't even have __str__ or __repr__.
I think the only thing we have now it write, which can do this:
>>> config = configparser.ConfigParser()
>>> config['DEFAULT'] = {'ServerAliveInterval': '45','Compression': 'yes','CompressionLevel': '9'}
>>> f = io.StringIO()
>>> config.write(f)
>>> f.getvalue()
'[DEFAULT]\nserveraliveinterval = 45\ncompression = yes\ncompressionlevel = 9\n\n'
>>> pprint.pprint(f.getvalue())
('[DEFAULT]\n'
'serveraliveinterval = 45\n'
'compression = yes\n'
'compressionlevel = 9\n'
'\n')
>>>
Is this enough, or should something be added?
----------
nosy: +iritkatriel
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue19991>
_______________________________________
More information about the Python-bugs-list
mailing list