我有两个变量,假设为x和y,我需要检查它们中哪一个是
None
。if x is None and y is None:
# code here
else:
if x is not None and y is not None:
# code here
else:
if x is None:
# code here
if y is None:
# code here
有更好的方法来做这件事吗?
我正在寻找一个更短的 IF ELSE
结构。