remove html tag from string python code example
Example 1: remove html tags from string python
import re
def cleanhtml(raw_html):
cleanr = re.compile('<.*?>')
cleantext = re.sub(cleanr, '', raw_html)
return cleantext
Example 2: remove all html tags and text from string python
string = "<p>frwefb</p>"
BeautifulSoup(string, "lxml").text