Python - Strip tags from a String

This is a little snippet to remove tags from a string to get the only raw textual content. I'm using the Beautiful Soup Library [1] for this job.

Install Beautifulsoup with pip:

pip install beautifulsoup4

Example:

from bs4 import BeautifulSoup
html = "<html><body><h1>Test</h1><body><html>"
''.join(BeautifulSoup(html).get_text())

Comments !