亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

python - pyspider 如何獲取某個列表中的第n個元素
黃舟
黃舟 2017-04-18 10:31:15
0
2
640

response.doc('.link_nei>ul>li>a').items()
上面的語句是用來獲取所有符合條件的 <a>,我想獲得倒數(shù)第二個 <a> 應該怎么獲得? 教程上都是通過正則表達式去篩選,不過這種方法好 low 而且不實用

黃舟
黃舟

人生最曼妙的風景,竟是內(nèi)心的淡定與從容!

reply all(2)
PHPzhong
response.doc('.link_nei>ul>li>a').eq(-2).items()

Refer to the pyquery documentation https://pythonhosted.org/pyqu...

洪濤

I see you are using a CSS selector, just add :nth-last-child(2) after a.

CSS selector tutorial: http://www.w3school.com.cn/cs...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template