我正在使用http://www.voidspace.org.uk/python/configobj.html来解析我的配置,看起来它不允许你这样做:
[section 1]
[[sub-section 1]]
# this is in section 1
keyword1 = value1
keyword2 = value2
[[sub-section 2]]
# this is in section 1
keyword1 = value1
keyword2 = value2
它崩溃了:
ParsingError:文件包含解析错误:
如果我想要一个配置列表,比如一个 ftp 配置列表,我必须向父级提供一些无用的设置,这样它就不会像这样抱怨:
[section 1]
amIUseless = yesYouAre
[[sub-section 1]]
# this is in section 1
keyword1 = value1
keyword2 = value2
[[sub-section 2]]
# this is in section 1
keyword1 = value1
keyword2 = value2
这是故意的吗?我做错什么了吗?我可以避免添加那个无用的设置吗?