how to remove html tags python code example
Example 1: python remove html tags
from bs4 import BeautifulSoup
cleantext = BeautifulSoup(raw_html, "lxml").text
Example 2: python find remove html tags
import re
def cleanhtml(raw_html):
cleanr = re.compile('<.*?>')
cleantext = re.sub(cleanr, '', raw_html)
return cleantext