try: response = urllib.request.urlopen("http://www.douyu.com", timeout=0.01) print(response.read()) except urllib.error.HTTPError as e: print(e.code) except urllib.error.URLError as e: if isinstance(e.reason, socket.timeout): print('Time Out!')
主要对socket.timeout不理解,请各位大佬指教
习惯受伤
相关分类