【转】判断字符串是否是中文
原文链接: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
===今日我言===========
勇气 让人进步
===================
浙公网安备 33010602011771号