ConfigParser: use newline in INI file

Peter Otten __peter__ at web.de
Thu Mar 7 11:19:41 EST 2019


tony wrote:

>> On Saturday, October 1, 2016 at 7:41:40 PM UTC-5, Ned Batchelder wrote:

>>> If you want to have \n mean a newline in your config file, you can
>>> do the conversion after you read the value:
>>>
>>>     >>> "a\\nb".decode("string-escape")
>>>     'a\nb'

> How does that translate to Python3?

>>> import codecs
>>> codecs.decode("a\\nb", "unicode-escape")
'a\nb'





More information about the Python-list mailing list