Exception handling....dumb question?
Felipe Almeida Lessa
felipe.lessa at gmail.com
Fri Mar 31 19:01:05 EST 2006
Em Sex, 2006-03-31 às 15:51 -0800, kbperry escreveu:
> Is there a way to show what error it is throwing?
>
> Like in Java, you can do
> catch (Exception e){
> System.out.println(e);
> }
>
> Is there an equivalent way to do this in Python?
>>> try:
... print 1/0
... except Exception, e:
... print '*', e.__class__, '*'
... print '*', e, '*'
...
* exceptions.ZeroDivisionError *
* integer division or modulo by zero *
--
Felipe.
More information about the Python-list
mailing list