for a in soup.find_all('a', href=True):
print("Found the URL:", a['href'])
from bs4 import BeautifulSoup
text = '''
<tr align="center"><td><a href="#0">First</a></td></tr>,
<tr align="center"><td><a href="#1">This is second</a></td></tr>,
<tr align="center"><td><a href="#2">third</a></td></tr>
'''
soup = BeautifulSoup(text,'html.parser')
result = [ row.a.text for row in soup.find_all('tr')]
print(result)
result = [ row.text for row in soup.find_all('a')]
как удобнее для настройки дополнительных условий парсинга. from bs4 import BeautifulSoup
html = '''
<tr align="center"><td><a href="#0">KEY 0</a></td></tr>
<tr align="center"><td><a href="#1">KEY 1</a></td></tr>
'''
bs = BeautifulSoup(html, 'html.parser')
for item in bs.find_all('a'):
value = item.get('href')
if value and value.startswith("#"):
print(item.text) # KEY