以编程方式停止执行python脚本吗?
发布于 2021-01-29 19:07:10
是否可以通过命令在任何行停止执行python脚本?
喜欢
some code
quit() # quit at this point
some more code (that's not executed)
关注者
0
被浏览
53
1 个回答
-
sys.exit()可以完全满足您的要求。
import sys sys.exit("Error message")