1
dd0754 2017-12-30 01:27:47 +08:00 1
```python
import os import requests from lxml import etree res = requests.get('https://s.2.taobao.com/list/list.htm?_input_charset=utf8&q=小米 6&st_edtime=1').content txt = etree.HTML(res) items = txt.xpath('//div[@class="ks-waterfall"]') for item in items[1:]: print(item.attrib) a = item.xpath('./div/div[@class="item-info"]/div/a') for d in a: print(d.attrib) ``` |
2
F1024 OP @dd0754
import requests from lxml import etree res = requests.get('https://s.2.taobao.com/list/list.htm?_input_charset=utf8&q=ddr3 1866&st_edtime=1').content txt = etree.HTML(res) txt4 = txt.xpath('//div/div[@class="item-info"]/div/a') print(txt4[0].attrib.get('title')) 可以了 |