判断字符串是否以中文字符开头


import re

def check_chinese(words):
regex_str = ".*?([\u4E00-\u9FA5])"
match_obj = re.match(regex_str, words)
if match_obj:
a=match_obj.group(1)
if a:
index= words.find(a)
if index==0:
return True
else:
return False
else:
return False



if __name__ == '__main__':
print(check_chinese('自费'))


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM