2017-05-06 53 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)