Created
August 28, 2014 11:02
-
-
Save zhangw/1dc231c1f853556debdd to your computer and use it in GitHub Desktop.
convert unicode one-character to integer,return unicode one-character with ordinal integer.
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
| #unicode character | |
| char = u'\u2708' | |
| print char | |
| #integer value of the character | |
| ord_char = ord(char) | |
| print ord_char,hex(ord_char) | |
| #return the character | |
| uni_char = unichr(ord_char) | |
| assert(char==uni_char) | |
| print uni_char |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment