exit() in python code example
Example 1: python exit program
import sys
sys.exit()
Example 2: python exit program
import sys
sys.exit("Code not Pythonical")
import os
os._exit()
quit()
exit()
Example 3: exit in python
import sys
msg = "bye bye"
sys.exit(msg)
Example 4: how to exit program in python
import sys sys.exit() //This will exit the python program
Example 5: how to exit a function python
quit = True
def example():
if quit:
return
print(example())
def example2():
return (1+1)
print(example2())