码迷,mamicode.com
首页 > 编程语言 > 详细

python 判断字符串中是否只有中文字符

时间:2018-05-28 21:19:46      阅读:294      评论:0      收藏:0      [点我收藏+]

标签:color   判断字符串   false   .com   tps   def   https   中文字符   中文   


python 判断字符串中是否只有中文字符

学习了:https://segmentfault.com/q/1010000007898150

def is_all_zh(s):
    for c in s:
        if not (\u4e00 <= c <= \u9fa5):
            return False
    return True

 

python 判断字符串中是否只有中文字符

标签:color   判断字符串   false   .com   tps   def   https   中文字符   中文   

原文地址:https://www.cnblogs.com/stono/p/9102073.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!