write something when close a program python code example Example: exit python script import sys sys.exit()