我在 Python 2.7 中使用 ConfigParser 来读取配置文件,我想知道如何读取一个值,以便在 Python 中将其设置为常量 None
。
目前我的代码如下:
config.set("Test Series Parameters", "Test Series Parameter", None)
但是,这显示为 Test Series Parameter = "None"
(作为字符串)。
最佳答案
根据 2.7.2 文档:
When
allow_no_value
istrue
(default:False
), options without values are accepted; the value presented for these isNone
. Does that help?
关于python - 如何使用 ConfigParser 将值设置为 None?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9335885/