Skip to content

Instantly share code, notes, and snippets.

View jspri's full-sized avatar

Justin Sprigg jspri

  • Frameplay
  • Melbourne, Australia
View GitHub Profile
@jspri
jspri / html_to_text.py
Last active February 25, 2020 07:37
Converts html to plain text in python3. Only standard libraries used.
"""
HTML <-> text conversions.
http://stackoverflow.com/questions/328356/extracting-text-from-html-file-using-python
"""
from html.parser import HTMLParser
from html.entities import name2codepoint
import re
class _HTMLToText(HTMLParser):
def __init__(self):
045e10373243c46b202e07abe7dfa6256d82a85935804fde562c3c62f64080212b35619da64717ccfd68429e81f5201bc62b5b584e440ca96c4ab5e6471f35415f;sketchthat