1. 首页
  2. 数据库
  3. 其它
  4. python 检查是否为中文字符串的方法

python 检查是否为中文字符串的方法

上传者: 2020-12-31 11:36:20上传 PDF文件 41.85KB 热度 15次
【目标需求】 查看某一个字符串是否为中文字符串 【解决办法】 def check_contain_chinese(check_str): for ch in check_str: if u'\u4e00' <= ch <= u'\u9fff': return True else: return False 【举例检验】 check_contain_chinese('abcc') False check_contain_chinese('123') False check_contain_chinese('中文') True 问题解决! —————–2018-07-
下载地址
用户评论