|
先上代码:import unicode
def pa(url_pa, filebox):
def get_html(asd):
headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"}
req = urllib.request.Request(url=asd, headers=headers)
html = urlopen(req)
print(html)
qwe = html.read()
qw = unicode(qwe, 'gb2312').encode('utf-8')
东西是爬虫相关的,刚开始学,现在的问题是,最后一行unicode 总是提示没有unicode的包,我安装了也找不到这个包,各位前辈,怎么回事,是我安装的包名字不对,还是什么问题,感谢!
|
|