python get exit code os.system code example
Example 1: python system exit
import sys
age = 17
if age < 18:
sys.exit("Age less than 18")
else:
print("Age is not less than 18")
Example 2: python system exit
import sys
sys.exit(0)
import sys
age = 17
if age < 18:
sys.exit("Age less than 18")
else:
print("Age is not less than 18")
import sys
sys.exit(0)