I got this code while I was looking into urllib2.
import urllib2
req = urllib2.Request('http://www.baibai.com')
try: urllib2.urlopen(req)
except urllib2.URLError,e:
print e.reason
I got confused when and whether to use e
in the statement except urllib2.URLError, e:
since it seems OK to use except urllib2.URLError:
(without e
).
Can every except
statement have the format except:XXXX, e
or just in some cases?