1from BeautifulSoup import BeautifulSoup
2
3html = '''<a href="some_url">next</a>
4<span class="class"><a href="another_url">later</a></span>'''
5
6soup = BeautifulSoup(html)
7
8for a in soup.find_all('a', href=True):
9 print "Found the URL:", a['href']