使用requests_html进行抓取时如何获取最后一个元素

问题描述 投票:0回答:1

我尝试用requests_html废弃一些东西。有几个div标签包含我想要废弃的类名。我知道你可以选择first=True的第一个元素:

driver.html.find(".company__item-value", first=True)

但是,如果我只想选择班级company__item的最后一个元素,我该怎么办?

enter image description here

python web-scraping python-requests-html
1个回答
0
投票

找到所有元素并获得最后一个find(...)[-1]

© www.soinside.com 2019 - 2024. All rights reserved.