python3判断字符串内是否含有字母,并打印字母出来
# !/usr/bin/python3.4
# -*- coding: utf-8 -*-
import re
a = "8a2656"
b = "1514561A1321"
c = "15465461654"
d = "afgwgw"
r = re.compile(r'^[a-zA-Z]')
for item in d:
result = r.match(item)
if result != None:
print("包含字母:" + result.group())
else:
print("不包含字母")
包含字母:a
包含字母:f
包含字母:g
包含字母:w
包含字母:g
包含字母:w