コマンドを使用して任意の行で Python スクリプトの実行を停止することは可能ですか?
のように
some code
quit() # quit at this point
some more code (that's not executed)
ベストアンサー1
sys.exit()まさにあなたが望む通りのことを行います。
import sys
sys.exit("Error message")
コマンドを使用して任意の行で Python スクリプトの実行を停止することは可能ですか?
のように
some code
quit() # quit at this point
some more code (that's not executed)
sys.exit()まさにあなたが望む通りのことを行います。
import sys
sys.exit("Error message")