"Closing" a script...
Ok, all I want ot know is how to close a script on command, lie type 3 to exit, what modules do i need to import and what is the command, I have everything else sorted out...
EDIT: The close command will go in a if statement, which is in a function.
EDIT2: Never mind, problem solved, go ahead and close or delete this topic admins...
danizzil14
Junior Poster in Training
68 posts since Jul 2005
Reputation Points: 16
Solved Threads: 1
Just in case others are interested, to exit a program use ...
import sys
sys.exit()
or easier ...
raise SystemExit
vegaseat
DaniWeb's Hypocrite
5,976 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,416
Just in case others are interested, to exit a program use ...
import sys
sys.exit()
or easier ...
raise SystemExit
Yes,quite interesting, actually-- I was just wondering about this; I searched via google for sys.exit() to gather some more info and found a lot of scattered information that told me either too little or to much. It seems this way with Python docs\tutorials\etc on the Net IMO.
I come to and search and... here some vital information is. (as usual ;))
vegaseat: can you elaborate on why using SystemExit is "easier"
just so I can understand it better. I just used it-- worked just fine. :)
Thanks a lot,
Matty
mattyd
Posting Maven
2,607 posts since Oct 2006
Reputation Points: 105
Solved Threads: 1