Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

response.doc('.link_nei>ul>li>a').items()
上面的语句是用来获取所有符合条件的 <a>,我想获得倒数第二个 <a> 应该怎么获得? 教程上都是通过正则表达式去筛选,不过这种方法好 low 而且不实用


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
689 views
Welcome To Ask or Share your Answers For Others

1 Answer

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

参考 pyquery 的文档 https://pythonhosted.org/pyqu...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...