python判断是否包含英文字符

import re

# 判断是否包含英文
str = "text文本"
contain_en = bool(re.search('[a-z]', str))

if contain_en:
    print("包含英文字符")
else:
    print("不包含英文字符")

 

posted @ 2019-09-13 15:26  Jumpkin1122  阅读(6132)  评论(0编辑  收藏  举报