如何选取具有“href”或“onclick”use python beautifulsoup的所有链接

2024-06-16 11:12:02 发布

您现在位置:Python中文网/ 问答频道 /正文

for lnk in soup.find_all('a', attrs={'href': re.compile('.+')}):
for lnk in soup.find_all('a', attrs={'onclick': re.compile('.+')}):

如何选择所有这些具有href not empty或onclick attr的标记


Tags: in标记refornotallfindattrs