摘要:
# -*- coding: cp936 -*- import requests from lxml import etree url = 'https://weibo.cn/pub/' html = requests.get(url).content #先用.content再用etree.HTML(html)方法,不然报错 selector = etree.HTML(html) ''' #... 阅读全文
摘要:
content是bytes数据,包括图片等二进制数据;text是网页代码 content在python 2.7版本中可以顺利打印出网页代码;但是在Python3.6上面打印的中文是乱码,而且很卡,代码持续行状态 text在python 2.7版本中打印出网页代码中文乱码;在Python3.6上面打印 阅读全文