[Tutor] Using sys.exit()
Dick Moores
rdm at rcblue.com
Tue Oct 31 03:12:34 CET 2006
At 05:06 PM 10/30/2006, Dick Moores wrote:
>I'd like to know how to use sys.exit() to quit a program.
>
>Here's a simple example:
>
>import sys
>
>c = 0
>while True:
> c += 1
> if c > 10000:
> sys.exit()
>
>Now, this will certainly exit, but not without a lot of extra noise.
>Is there a way to use it the way I want to? Maybe with an argument?
>I'm writing a script, which in a couple of places I can't use "break" to quit.
I just found this:
<http://www.velocityreviews.com/forums/t359590-how-to-terminate-a-main-script.html>
So the "noise" from sys.exit() is from using it "inside" Wing IDE. At
the command line, the exit is silent.
Sorry for the disturbance.
Dick
>Thanks,
>
>Dick Moores
>
>_______________________________________________
>Tutor maillist - Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list