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

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('自费'))
posted @ 2020-09-15 10:13  fyangq  阅读(818)  评论(0编辑  收藏  举报