> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Andy Koch
> Sent: Tuesday, June 13, 2006 8:42 AM
> To: tutor@python.org
> Subject: [Tutor] die or exit function?
> 
> Bkgd: I've been doing PHP for the last several years.
> 
> Q: In PHP there are functions die and exit which terminate 
> processing of 
> a script with an optional string output.  Is there something 
> similar to 
> this in Python?
> 


sys.exit("something bad happened")

Although it's probably better to catch the exception and deal with it and
then sys.exit() if need be.

Mike
http://users.adelphia.net/~mahansen/programming/

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to