exit(0) in python code example
Example 1: exit python script
import sys
sys.exit()
Example 2: why doesn't sys.exit work?
import sys
try:
sys.exit() # this always raises SystemExit
except SystemExit:
print("sys.exit() worked as expected")
except:
print("Something went horribly wrong") # some other exception got raised
Example 3: exit in python
import sys
msg = "bye bye"
sys.exit(msg)
# you can use it with out a msg