+ 1
how to make python stop before closing a program and only after it can be close if we type close in input
help am saying the output
3 Réponses
+ 1
So you’re saying stop the program when the user types in ‘close’?
import sys
usr_input = input()
if usr_input == "close":
sys.quit(0)
Put it in a infinite loop or whatever
0
I think you mean stop the program not Python you cannot close Python without the program closing too because it is an interpreter. Import the standard sys module then use sys.quit(0) which will stop the program.
0
no the output i am saying