10

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).

fenceop
  • 1,439
  • 3
  • 18
  • 29
Parth
  • 1,226
  • 7
  • 28
  • 49

1 Answers1

21

According to the 2.7.2 docs:

When allow_no_value is true (default: False), options without values are accepted; the value presented for these is None. Does that help?

Carlos
  • 1,897
  • 3
  • 19
  • 37