How to Catch 2 Exceptions at once?
jstroud at mbi.ucla.edu
Sun Oct 1 04:11:41 CEST 2006
Gregory Piñero wrote:
> How can I catch 2 exceptions at once for example:
> self.gses = opener.open(req)
> except (urllib2.HTTPError,urllib2.URLError):
> do something..
> Seems to work, but how do I also get information about the error?
... raise ValueError, 'Illegal value for your shoe size!'
... except (IndexError, ValueError), e:
... print e
Illegal value for your shoe size!
UCLA-DOE Institute for Genomics and Proteomics
Los Angeles, CA 90095
More information about the Python-list