原因:
类型错误:
pyquery 是类型jquery 的一个专供python使用的html解析的库,使用方法类似bs4。
4.使用方法
4.1 初始化方法:
from pyquery import PyQuery as pq doc =pq(html) #解析html字符串 doc =pq("http://news.baidu.com/") #解析网页 doc =pq("./a.html") #解析html 文本
源代码:
html = requests.get(url, headers=header_pinlun,proxies={'http':'157.7.198.238:1080'})
print("1 ===> STATUS", html.status_code)
print(html.content.decode(encoding="utf-8"))
doc = pq(html)
html = requests.get(url, headers=header_pinlun,proxies={'http':'157.7.198.238:1080'})
print("1 ===> STATUS", html.status_code)
print(html.content.decode(encoding="utf-8"))
doc = pq(html.text)