📜  如何检查是否设置了 var python 代码示例

📅  最后修改于: 2022-03-11 14:45:07.295000             🧑  作者: Mango

代码示例1
try:
    thevariable
except NameError:
    print("well, it WASN'T defined after all!")
else:
    print("sure, it was defined.")