王河云

王河云的博客

他的个人主页  他的博客

判断字符串中是否又汉字

王河云  2009年12月14日 星期一 15:59 | 1350次浏览 | 0条评论

汉字,正则

1.Regular Expressions
a =u"汉字"
re.search(ur"[\u4e00-\u9fa5]+",a)


2.Function
def is_chinese(uchar):
if uchar >= u'\u4e00' and uchar<=u'\u9fa5':
return True
else:
return False

评论

我的评论:

发表评论

请 登录 后发表评论。还没有在Zeuux哲思注册吗?现在 注册 !

暂时没有评论

Zeuux © 2024

京ICP备05028076号