Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@kawa-kokosowa kawa-kokosowa commented Jun 16, 2018

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