The following is the file parsed by ConfigParser:
[Ticket]
description = This is a multiline string.
1
2
4
5
7
As described by the official Python wiki for ConfigParser examples, here is the helper function:
def ConfigSectionMap(section):
dict1 = {}
options = Config.options(section)
for option in options:
try:
dict1[option] = Config.get(section, option)
if dict1[option] == -1:
DebugPrint("skip: %s" % option)
except:
print("exception on %s!" % option)
dict1[option] = None
return dict1
The resulting value is:
>>> print ConfigSectionMap('Ticket')['description']
This is a multiline string.
1
2
4
5
7
The expected value was:
>>> print ConfigSectionMap('Ticket')['description']
This is a multiline string.
1
2
4
5
7
How do I fix this?
One way to fix it is to modify the helper function to: