我正在尝试使用urllib在python3.6中查找网页上的字符串,而我发现的解决方案对于我测试过的大多数网页都很有用,例如:>>for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno11004] getaddrinfofailed During handling of the abov
>>> urllib2.urlopen("http://www.google.com").read()urllib2.URLError: <urlopenerror [Errno 10061]No connection could be made because the target machine actively refused it>urllib2.URLError: <urlope
到目前为止,这是我的代码:#print(urllib.request.urlopenWebsite is working') print("Website is down or doesn't exist")
但是,如果网站关闭,或者它不存在,代码将返回两个场景的URLErrorException has occurred: URLError<