最佳答案
如果我有这样一个结构:
def foo():
a=None
b=None
c=None
#...loop over a config file or command line options...
if a is not None and b is not None and c is not None:
doSomething(a,b,c)
else:
print "A config parameter is missing..."
Python 中检查所有变量是否设置为有用值的首选语法是什么?是像我写的那样,还是另一种更好的方式?
这不同于这个问题: Not Nothing test in Python ... 我正在寻找检查许多条件是否为 Nothing 的首选方法。我键入的选项看起来很长,而且不是 pythonic。