W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
demo_python_ref_keyword_raise_2.py:
x = "hello" if not type(x) is int: raise TypeError("Only integers are allowed")
C:\Users\My Name>python demo_python_ref_keyword_raise_2.py
Traceback (most recent call last):
File "demo_python_ref_keyword_raise_2.py", line 4, in <module>
raise TypeError("Only integers are allowed")
TypeError: Only integers are allowed