- 本版本为Python3 的版本
- 导入依赖包
import importlib, sys
importlib.reload(sys)
- 定义判断函数
def check_contain_chinese(check_str):
for ch in check_str.encode('utf-8').decode('utf-8'):
if u'\u4e00' <= ch <= u'u9fff':
return True
return False
- 调用函数
check_contain_chinese('I love you')
- 返回结果
False
参考文章: