[Tutor] die or exit function?

Mike Hansen mhansen at cso.atmel.com
Tue Jun 13 19:15:53 CEST 2006


 

> -----Original Message-----
> From: tutor-bounces+mhansen=cso.atmel.com at python.org 
> [mailto:tutor-bounces+mhansen=cso.atmel.com at python.org] On 
> Behalf Of Andy Koch
> Sent: Tuesday, June 13, 2006 8:42 AM
> To: tutor at 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/



More information about the Tutor mailing list