Last active
November 8, 2018 10:33
-
-
Save search5/a144d0b8bac6bc996ddc0267dced2dbf to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from html.entities import entitydefs | |
from functools import partial | |
def html5char(value): | |
def key_find(find_value, key): | |
return entitydefs[key] == find_value | |
f = filter(partial(key_find, value), entitydefs) | |
return "&{0};".format(tuple(f)[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment