Created
July 31, 2013 16:45
-
-
Save funkatron/6123802 to your computer and use it in GitHub Desktop.
strip HTML using Bleach python lib
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
import bleach | |
def strip_html(html_str): | |
""" | |
a wrapper for bleach.clean() that strips ALL tags from the input | |
""" | |
tags = [] | |
attr = {} | |
styles = [] | |
strip = True | |
return bleach.clean(html_str, | |
tags=tags, | |
attributes=attr, | |
styles=styles, | |
strip=strip) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was just what I was looking for. Odd this isn't built-in or anything...