2017-05-06 55 views
0

我怎樣才能從HREF中再混音從部分上左側以下頁面Beautifulsoup返回沒有價值的HREF如何選擇它?

webpage = 'http://www.thingiverse.com/thing:1492411' 

我想是這樣的:

response = requests.get('http://www.thingiverse.com/thing:1492411') 
soup = BeautifulSoup(response.text, "lxml") 
remm = soup.find_all("a", class_="thing-stamp") 
for rems in remm: 
    adress = rems.find("href") 
    print(adress) 

當然沒有工作

編輯:HTML標籤看起來來樣這樣:

<a class="thing-stamp" href="/thing:1430125"> 
<div class="stamp-content"> 
<img alt="" class="render" src="https://cdn.thingiverse.com/renders/57/ea/1b/cc/c2/1105df2596f30c4df6dcf12ca5800547_thumb_small.JPG"/> <div>Anet A8 button guide by Simhopp</div> 
</div> 
</a> 
<a class="thing-stamp" href="/thing:1430727"> 
<div class="stamp-content"> 
<img alt="" class="render" src="https://cdn.thingiverse.com/renders/93/a9/c8/45/da/05fe99b5215b04ec33d22ea70266ac72_thumb_small.JPG"/> <div>Frame brace for Anet A8 by Simhopp</div> 
</div> 
</a> 

回答

2

試試:

remm = soup.find_all("a", class_="thing-stamp") 
for rems in remm: 
    adress = rems.get('href') 
    print(adress)