首页 > 其他 > 详细

【转】判断字符串是否是中文

时间:2020-08-22 08:15:00      阅读:53      评论:0      收藏:0      [点我收藏+]

原文链接:https://www.jb51.net/article/153637.htm

 

# 检验是否含有中文字符
def isContainChinese(s):
    for c in s:
        if (‘\u4e00‘ <= c <= ‘\u9fa5‘):
            return True
    return False


# 检验是否全是中文字符
def isAllChinese(s):
    for c in s:
        if not (‘\u4e00‘ <= c <= ‘\u9fa5‘):
            return False
    return True

  

【转】判断字符串是否是中文

原文:https://www.cnblogs.com/wtmb/p/13543992.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!