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?
Update: The link I gave you below was to Python 3.0, my apologies I forgot your tag.
The 2.7 docs do not mention blank lines in values, so I suspect they are not supported at all.
See also this SO question (which looks like Python 3): How to read multiline .properties file in python
From the documentation:
I don't know what 'parser mode' this is referring to, but not sure if what you want is doable.
On the other hand, the docs also mention the
empty_lines_in_valuesoption, which seems to indicate that blank lines are supported. Seems somewhat contradictory to me.