漢字unicode編碼範圍
- 匹配簡體和繁體 :\u4E00-\u9FFF
- 匹配簡體 :\u4E00-\u9FA5
def is_contain_chinese(check_str):
"""
判斷字符串中是否包含中文
:param check_str: 需要檢測的字符串
:return: 包含返回True, 不包含返回False
"""
for ch in check_str:
if '\u4e00' <= ch <= '\u9fff':
return True
return False
is_contain_chinese('hellos- dd')
>>>>> False
is_contain_chinese('我llos- dd')
>>>>> True