I want to check my environment for the existence of a variable, say
"FOO", in Python. For this purpose, I am using the
os standard library. After reading the library's documentation, I have figured out 2 ways to achieve my goal:
if "FOO" in os.environ: pass
if os.getenv("FOO") is not None: pass
I would like to know which method, if either, is a good/preferred conditional and why.