LoginSignup
1
0

More than 1 year has passed since last update.

【Python】try~except文でsys.exitをしたときにfinallyで書いた内容が実行されるか

Posted at

結論:される

import sys

print("start")

try:
    print("try")
    raise Exception

except:
    print("except")
    sys.exit(1)

finally:
    print("finally")

print("end")
$ python3 ./test.py 
start
try
except
finally
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0