execution error

Ximo elrei69 at yahoo.es
Tue May 24 10:39:33 EDT 2005


"Skip Montanaro" <skip at pobox.com> escribió en el mensaje 
news:mailman.30.1116869883.18027.python-list at python.org...
>
>    Ximo> And my question is how can show the execution error whitout exit
>    Ximo> of the program, showing it in the error output as
>
> You need to catch ZeroDivisionError.  Here's a trivial example:
>
>    >>> try:
>    ...   6/0
>    ... except ZeroDivisionError:
>    ...   print "whoops! divide by zero..."
>    ...
>    whoops! divide by zero...

But I execute the operation in the else:

    try:
       except ZeroDivisionError:
       print "whoops! divide by zero..."
    else:
       execute( )

The exeption is produced after.









>
> Skip 





More information about the Python-list mailing list