判斷字符串是否以中文字符開頭


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