I'm using ConfigParser in Python 2.7 to read from a config file and I'm wondering how to read a value such that it's set to the constant None
in Python.
Currently, my code is as follows:
config.set("Test Series Parameters", "Test Series Parameter", None)
However, this shows up as Test Series Parameter = "None"
(as a string).
ConfigParser is a Python class which implements a basic configuration language for Python programs. It provides a structure similar to Microsoft Windows INI files. ConfigParser allows to write Python programs which can be customized by end users easily.
A Python configuration file is a pure Python file that populates a configuration object. This configuration object is a Config instance.
An INI file is a configuration file for computer software that consists of a text-based content with a structure and syntax comprising key–value pairs for properties, and sections that organize the properties.
According to the 2.7.2 docs:
When
allow_no_value
istrue
(default:False
), options without values are accepted; the value presented for these isNone
. Does that help?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With