Python 2.7: test if characters in a string are all Chinese characters
Asked 2013-05-08T13:10:32.097
8
The following code tests if characters in a string are all Chinese characters. It works for Python 3 but not for Python 2.7. How do I do it in Python 2.7?
for ch in name:
if ord(ch) < 0x4e00 or ord(ch) > 0x9fff:
return False