def extract_links(html):
    soup = BeautifulSoup(html)
anchors = soup.findAll('a')
print(anchors)
links = []
for a in anchors:
    if 'href' in a.attrs:
        links.append(a['href'])
Модуль Python BeautifulSoup, извлекающий якоря href