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

更新时间:02-09 教程 由 |唁 分享

python判断字符串是否有中文符号?

def is_chinese(s): count = 0 for i in s: if (i >= u'\u4e00') and (i <=u'\u9fa5'): return True break else: count += 1 if count == len(s): return False 然后检查有没有中文就输is_chinese('内容'),记住括号里的字符串要加引号

声明:关于《python判断字符串是否有中文符号》以上内容仅供参考,若您的权利被侵害,请联系13825271@qq.com
本文网址:http://www.25820.com/tutorial/14_2170539.html