URLError产生的原因
网络无连接连接不到特定的服务器服务器不存在from urllib.request import Request,urlopenfrom fake_useragent import UserAgentfrom urllib.error import URLErrorurl = 'http://www.woainiyyyyyyy.com'headers = { 'User-Agent':UserAgent().chrome}req = Request(url,headers=headers)try: resp = urlopen(req) print(resp.read().decode())except URLError as e: #print(e) if e.args: print(e.args[0].errno) else: print(e.code)print('爬取完成')插入代码片