Skip to content

Instantly share code, notes, and snippets.

@jdhao
Last active February 14, 2019 02:33
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 jdhao/ee7c18265fca029a86372d59f7fea2ca to your computer and use it in GitHub Desktop.
Save jdhao/ee7c18265fca029a86372d59f7fea2ca to your computer and use it in GitHub Desktop.
How to show the Unicode code point of a character or show the character corresponding to a certain code point in Python 3.
# show code point in hexadecimal format,
# see reference https://stackoverflow.com/questions/38909362/is-there-a-way-to-find-a-characters-unicode-code-point-in-python-2-7
hex(ord('我'))
# get the character corresponding to a code point,
# reference: https://stackoverflow.com/questions/10715669/python-unicode-codepoint-to-unicode-character
chr(0x6211) # the code point of 我 is \u6211
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment