“
Error 404: File Not Found
…… etc…
When an error is raised the server responds by returning an HTTP error code and an error page. You can use the HTTPError instance as a response on the page returned. This means that as well as the code attribute, it also has read, geturl, and info, methods. »> req = urllib2.Request(‘http://www.python.org/fish.html’) »> try: »> urllib2.urlopen(req) »> except URLError, e: »> print e.code »> print e.read() »> 404