![](/img/trans.png)
[英]is there a way to find these hrefs with my code without finding all hrefs that match my if statement?
[英]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')})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.