以下是ConfigParser解析的文件:
[Ticket]
description = This is a multiline string.
1
2
4
5
7
正如ConfigParser 示例的官方 Python wiki 所述,这里是辅助函数:
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
结果值为:
>>> print ConfigSectionMap('Ticket')['description']
This is a multiline string.
1
2
4
5
7
预期值为:
>>> print ConfigSectionMap('Ticket')['description']
This is a multiline string.
1
2
4
5
7
我该如何解决?