I need take "href" attribute from a link (a) tag.
I run
label_tag = row.find(class_='Label')
print(label_tag)
and I get (sorry, I can't show link and text for privacy reasons)
<a class="Label" href="_link_">_text_</a>
of type
<class 'bs4.element.Tag'>
but when I run (as shown at BeautifulSoup getting href )
tag_link = label_tag['href']
print(tag_link)
I guess the following error (on first command)
TypeError: 'NoneType' object is not subscriptable
Any clue? Thanks in advance
[SOLVED] EDIT: I was making a mistake (looping over elements with heterogeneous structure)