I got the list mixed with Tag and NavigableString Type. I want to access only Tag data. How can I check? I want to avoid the following error.
AttributeError: type object 'BeautifulSoup' has no attribute 'NavigableString'
from bs4 import Tag, NavigableString, BeautifulSoup
html = r"<b>The Dormouse's story</b>"
soup = BeautifulSoup(html, 'lxml')
print(isinstance(soup, Tag))
print(isinstance(soup.string, NavigableString))
out:
True
True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With