beautifulsoup remove all html tags 1

beautifulsoup remove all html tags

# credit to the Stack Overflow user in the source link

from bs4 import BeautifulSoup

soup = BeautifulSoup(html)
text = soup.get_text()
print(text)

Here is what the above code is Doing:
1. We import the BeautifulSoup class creator from the package bs4.
2. We create an instance of the BeautifulSoup class and assign it to variable soup.
3. We use the get_text() method on the soup object to extract the text without html tags.
4. We print the text to the console.

Similar Posts