Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Strip all HTML from string using BeautifulSoup
from BeautifulSoup import BeautifulSoup
body = "<p>Dear Everyone,</p><p>This is a test</p><h1>Test Complete</h1>"
plain_text = ' '.join(BeautifulSoup(body).findAll(text=True))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.