Created
February 3, 2012 09:30
-
-
Save mrchilds/1729289 to your computer and use it in GitHub Desktop.
Strip all HTML from string using BeautifulSoup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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