获取标题时报错
来源:2-9 爬取京东网的数据

慕粉3543411
2019-05-30
Traceback (most recent call last):
File “D:/pydemo/demo/pyTools/spider_jd2.py”, line 33, in
spider(sn)
File “D:/pydemo/demo/pyTools/spider_jd2.py”, line 26, in spider
title = li.xpath(‘div/div[@class=“p-name”]/a/text()’)
AttributeError: ‘lxml.etree._ElementUnicodeResult’ object has no attribute ‘xpath’
Process finished with exit code 1
写回答
1回答
-
pip install lxml
重新安装一下012019-06-03
相似问题