]> jfr.im git - z_archive/twitter.git/blame - twitter/util.py
Another removal of term encoding (py3_only)
[z_archive/twitter.git] / twitter / util.py
CommitLineData
8ad2cf0b 1"""
2Internal utility functions.
3
4`htmlentitydecode` came from here:
5 http://wiki.python.org/moin/EscapingHtml
6"""
7
8
9import re
f7e63802 10from html.entities import name2codepoint
8ad2cf0b 11
12def htmlentitydecode(s):
13 return re.sub(
14 '&(%s);' % '|'.join(name2codepoint),
f7e63802 15 lambda m: chr(name2codepoint[m.group(1)]), s)
8ad2cf0b 16
17__all__ = ["htmlentitydecode"]