Answer the question
In order to leave comments, you need to log in
How to get href attribute value from 'a' tag via BeautifulSoup functions?
I am writing a parser, at this stage there is a function
def parse(html):
soup = BeautifulSoup(html)
quests = []
div = soup.find('div', class_='container-fluid cols_table show_visited')
for row in div.find_all('div', 'row'):
cols = row.find_all('div', 'col-sm-7')
a = cols[0].find('a', class_='title')
quests.append({
'title': a.text,
'urls': a.href
})
for quest in quests:
print(quest)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question