reason: [Errno 10060]
import urllib2 #req = urllib2.Request('http://localhost/thinkphp323/Application/') req = urllib2.Request('http://www.xxxxx.com') try: urllib2.urlopen(req) except urllib2.URLError, e: if hasattr(e, "code"): print "code:",e.code if hasattr(e, "reason"): print "reason:",e.reason else: print "OK"
C:\Python27\python.exe D:/PycharmProjects/PySpider/HTTPurlError.py reason: [Errno 10060]

 
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号