Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
find emojis under 100000/hex 186A0
#py3 - find emojis under 100000/hex 186A0
import os
MAX_NR = 100000
URL = ''
TXT_NAME = 'emoji-test.txt'
TXT_PATH = os.path.abspath(os.path.join(__file__, '..', TXT_NAME))
emojis = {}
content = ''
if os.path.isfile(TXT_PATH):
with open(TXT_PATH, encoding='utf8') as fob:
content =
import urllib.request
content = urllib.request.urlopen(URL).read().decode()
for line in content.split('\n'):
if line.startswith('#'):
if not line.strip():
# get number blocks and description
nrs_str, line_end = line.split(';', 1)
nrs = nrs_str.strip().split()
# skip ones with multiple nr blocks
if len(nrs) > 1:
# convert from hex
nr = int(nrs[0], 16)
if nr < MAX_NR:
emojis[nr] = line_end.rsplit('#')[1].strip()
for nr, txt in sorted(emojis.items()):
print('&&#35;%i; : %s' % (nr, txt))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment