raise函数可以终止代码的运行
print('hello') raise '终止运行,并报异常' print('word') 执行结果>>>: hello Traceback (most recent call last): File "D:/Users/72036454/Desktop/pythonProject2/test_002.py", line 3, in <module> raise '终止运行,并报异常' TypeError: exceptions must derive from BaseException
标签:raise,python,代码运行,终止,print,hello From: https://www.cnblogs.com/FBGG/p/17258643.html