![]() | 1 janda 2022-04-19 13:35:05 +08:00 xpath |
![]() | 2 colatea 2022-04-19 13:39:11 +08:00 我用 xpath,大同小异,取到 div 内容为 2022.04.18 以后,向上找父节点,再向下找 table html.xpath("\\div[text()='2022.04.18']/../table/tbody") |
![]() | 3 a href="/member/Ritter" class="dark">Ritter 2022-04-19 13:40:16 +08:00 百度 bs4 doc |
![]() | 4 NotFoundEgg 2022-04-19 13:50:58 +08:00 divs = soup.findAll(name='div', attrs={"class": "dateDiv"}) for div in divs: if '2022.04.18' in div.next: table = div.find_next('table') |
5 Joshuam 2022-04-19 18:58:14 +08:00 via Android 推荐个 chrome 插件:SelectorGadget 只需点点点你要的数据,他给你 CSS Selector ,然后使用 bs4 处理 CSS Selector |
![]() | 6 AmberJiang 2022-04-25 15:55:55 +08:00 建议查看 BS4 的官方文档学习 |