Multiple ExceptionsCatching more than one exception type is easy
try:
statements
...
except IOError,e:
# Handle I/O error
...
except MemoryError,e:
# Handle out of memory error
...
except (IndexError, KeyError), e:
# Handle either an IndexError or a KeyError
...
Ignoring an exception
try:
statements
except IOError:
pass
|
| <<< | O'Reilly OSCON 2000, Introduction to Python, Slide 71 July 17, 2000, beazley@cs.uchicago.edu |
>>> |