using try and except, what is wrong with this?

David Ang davidang at info.com.ph
Tue May 27 12:18:19 EDT 2003


hmm..., it's working now hehe. i must have missed something a while ago.

thanks very much! :)


bokr at oz.net (Bengt Richter) wrote in message news:<bavc5h$368$0 at 216.39.172.122>...
> On 27 May 2003 00:46:57 -0700, davidang at info.com.ph (David Ang) wrote:
> 
> >hello,
> >
> >this is exactly from your tutorial documentation, but my python
> >interpreter is complaining...
> >
> >>>> def this_fail():
> >	x = 1/0
> >
> >>>> try:
> >	this_fail()
> >    except ZeroDivisionError, detail:
> >
> >IndentationError: unindent does not match any outer indentation level
> >(line 3)
> >
> Did you forget to supply an idented line after the except line? E.g.,
> 
>  >>> def this_fail():
>  ...     1/0
>  ...
>  >>> try:
>  ...     this_fail()
>  ... except ZeroDivisionError, detail:
>  ...     print detail
>  ...
>  integer division or modulo by zero
> 
> Seems to work. (A blank line interactively instead of "    print detail" will trigger
> interactive compile and execute, so it will complain about the missing line).
> 
> Regards,
> Bengt Richter




More information about the Python-list mailing list