在使用python3爬取网页时,发现urllib库中不存在urlopen属性,提示以下报错:
AttributeError: module 'urllib' has no attribute 'urlopen'
解决办法:
import urllib.request
get = urllib.request.urlopen("http://www.baidu.com").read()
在使用python3爬取网页时,发现urllib库中不存在urlopen属性,提示以下报错:
AttributeError: module 'urllib' has no attribute 'urlopen'
解决办法:
import urllib.request
get = urllib.request.urlopen("http://www.baidu.com").read()