Skip to content

Instantly share code, notes, and snippets.

@funkatron
Created July 31, 2013 16:45
Show Gist options
  • Save funkatron/6123802 to your computer and use it in GitHub Desktop.
Save funkatron/6123802 to your computer and use it in GitHub Desktop.
strip HTML using Bleach python lib
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)
@kawa-kokosowa
Copy link

This was just what I was looking for. Odd this isn't built-in or anything...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment