Skip to content

Instantly share code, notes, and snippets.

@RamonYeung
Last active February 14, 2018 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RamonYeung/a76da61987d7e4d652a0a65df7f1a7e0 to your computer and use it in GitHub Desktop.
Save RamonYeung/a76da61987d7e4d652a0a65df7f1a7e0 to your computer and use it in GitHub Desktop.
Display every Chinese character collected in Unicode char set.
# Recall that, in regex, we use [\u4e00-\u9fa5] to match chinese characters.
start = int("4e00", 16)
end = int("9fa5", 16)
for i in range(start, end + 1):
uni = r"\u" + hex(i)[2:]
result = uni.encode("utf-8").decode("unicode_escape")
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment