response.doc('.link_nei>ul>li>a').items()
上面的語句是用來獲取所有符合條件的 <a>,我想獲得倒數(shù)第二個 <a> 應該怎么獲得? 教程上都是通過正則表達式去篩選,不過這種方法好 low 而且不實用
人生最曼妙的風景,竟是內(nèi)心的淡定與從容!
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...