这是我的示例脚本:布尔在ConfigParser总是返回True
import ConfigParser
config = ConfigParser.ConfigParser()
config.read('conf.ini')
print bool(config.get('main', 'some_boolean'))
print bool(config.get('main', 'some_other_boolean'))
这是conf.ini
:
[main]
some_boolean: yes
some_other_boolean: no
运行脚本时,它打印True
两次。为什么?它应该是False
,因为some_other_boolean
设置为no
。
bah我有几乎相同的一组示例字符串... –