W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
demo_python_ref_keyword_try.py:
try: x > 3 except: raise Exception("Something went wrong") print("The program stops when an error is raised.")
[email protected]
:/home/python#python demo_python_ref_keyword_try.py
Traceback (most recent call last):
File "demo_python_ref_keyword_try.py", line 4, in <module>
raise Exception("Something went wrong")
Exception: Something went wrong