主页
Python
Python except 关键词
demo_ref_keyword_except2
运行 ❯
×
更改方向
保存代码
更改主题
# (x > 3) will raise an error because x is a string and 3 is a number, and cannot be compared using a '>': x = "hello" try: x > 3 except NameError: print("You have a variable that is not defined.") except TypeError: print("You are comparing values of different type")
You are comparing values of different type