Exception Handling

"Martin v. Löwis" martin at v.loewis.de
Mon Mar 28 18:59:24 CEST 2005


ias0nas at lycos.com wrote:
> Is it possible to bypass an exception and continue the code?
> If the exception is being raised in a while statement is it possible to
> bypoass it and continue with the next while?

while True:
   some_action()
   try:
     some_other_action_raising_KeyError()
   except KeyError:
     pass
   continue_after_exception_has_passed_by()

Regards,
Martin



More information about the Python-list mailing list