Wednesday, 28 March 2018

Clean HTML tags from string PYTHON | Remove html using Regex PYTHON

Use This method to remove html tags from string , working on python 3+.
It removes everything between <>


## -- Remove all html tags
  def cleanhtml(raw_html):
  cleanr = re.compile('<.*?>')
  cleantext = re.sub(cleanr, '', raw_html)
  return cleantext

No comments:

Post a Comment