from urllib.request import urlopen
html = urlopen("https://morvanzhou.github.io/static/scraping/basic-structure.html").read().decode('utf-8')
print(html)
from urllib.request import urlopen
html = urlopen("https://morvanzhou.github.io/static/scraping/basic-structure.html").read().decode('utf-8')
print(html.encode('utf-8'))
这种情况很可能发生,因为Atom的终端需要一种编码,而python则将该html编码为另一种编码。你在Windows上使用Atom吗
要解决此问题,请尝试将Atom终端配置为系统编码或将html编码为utf8:
相关问题 更多 >
编程相关推荐