python 判断字符串中是否含有汉字

如题所述

name = u'is this 中文'
if any(u'\u4e00' <= c <= u'\u9fff' for c in name.decode('utf-8')):
    print 'contain chinese'
else:
    print ' not contain chinese'

温馨提示:答案为网友推荐,仅供参考
第1个回答  2016-11-22
没涉及过python,不过猜测应该是用位比较法》?
相似回答