from bs4 import BeautifulSoup
html_doc = """
<html><head><title>The Dormouse's story</title></head><body><pclass="title"><b>The Dormouse's story</b></p><pclass="story">Once upon a time there were three little sisters; and their names were
<ahref="http://example.com/elsie"class="sister"id="link1">Elsie</a>,
<ahref="http://example.com/lacie"class="sister"id="link2">Lacie</a> and
<ahref="http://example.com/tillie"class="sister"id="link3">Tillie</a>;
and they lived at the bottom of a well.</p><pclass="story">...</p>
"""
soup = BeautifulSoup(html_doc, 'html.parser',from_encoding='utf-8')
for node in soup.find_all('a'):
print node.name,node['href'],node.get_text()