I am trying to run some code on Python IDLE, but when I use exit()
I am getting a pop-up. How can I remove this pop-up?
print "hi"
exit(-1)
Use exit()
from sys
module.
import sys
# your cool code here
sys.exit(0) # stops the program without a pop-up
For example in an if
:
import sys
x = 2
if x > 1:
print "x > 1"
sys.exit()
else:
print x