# -*- coding:utf-8 -*-
import re
def check(str):
my_re = re.compile(r'[A-Za-z]', re.S)
res = re.findall(my_re, str)
if len(res):
print(u'含有英文字符')
else:
print(u'不含有英文字符')
if __name__ == '__main__':
测试 = '你好123H'
check(测试)
str1 = '你好123'
check(str1)
python判断字符串是否包含英文字母
原创
©著作权归作者所有:来自51CTO博客作者ewwerpm的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
java检测字符串是否包含数字和字母
Java检测字符串是否包含数字和字母
git 字符串 正则表达式