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...

Just in case others are interested, to exit a program use ...

import sys
sys.exit()

or easier ...

raise SystemExit

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 <Daniweb> 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

This question has already been answered. Start a new discussion instead.