Created
August 13, 2013 12:00
-
-
Save mdjhny/6220412 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
def is_cn_char(i): | |
return 0x4e00<=ord(i)<0x9fa6 | |
def is_cn_or_en(i): | |
o = ord(i) | |
return o<128 or 0x4e00<=o<0x9fa6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment