查找所有以 ' ' 开头的 href
Find all hrefs that start with ' '
我正在尝试查找属于以 'start/of/link' 开头的 'a' 元素的所有 href。
这是我在看到这是对其他人类似问题的回答后尝试的,但没有用。
hrefs = soup.find_all('a', href=re.compile('^/start/of/link'))
我没有收到错误,但是打印 hrefs 变量时它是空的。
我觉得应该是这样的
soup.find_all('a', {"href" : re.compile('^/start/of/link')})
我正在尝试查找属于以 'start/of/link' 开头的 'a' 元素的所有 href。 这是我在看到这是对其他人类似问题的回答后尝试的,但没有用。
hrefs = soup.find_all('a', href=re.compile('^/start/of/link'))
我没有收到错误,但是打印 hrefs 变量时它是空的。
我觉得应该是这样的
soup.find_all('a', {"href" : re.compile('^/start/of/link')})