0

如何在 ConfigObj 中为跨越多行的基于字符串的值设置缩进,以使第二行等超过分隔符?

例如:

about = {'Info' : {'Purpose': 'blabla continues for fixed chars ...\
                  \n           and another line of bla ... etc.'}}    # here nicely aligned under "b" from bla.
                   # 11 white-spaces.

config = ConfigObj(indent_type= 3*' ', interpolation=True, encoding='utf8')
config.filename = 'lol.ini'
config['About'] = about
config.write()

此结果在 ini 文件中显示为:

[About]
   [[Info]]
      Purpose = '''blabla continues for fixed chars ...                               
           and another line of bla ... etc.''' # here the indentation goes sub-optimal/wrong.
# 11 white spaces but missing the indentations (6 white-spaces)

对于两个级别,缩进移位将添加 6 个空格(对于“关于”和“信息”3 个空格)。显然,“插值=真”不是诀窍。有什么建议么?

配置对象版本。= 5.0.6 比 = 3.9

4

0 回答 0