复制代码 代码如下:
import re
s1 = 'adkkdk'
s2 = 'abc123efg'
an = re.search('^[a-z]+$', s1)
if an:
print 's1:', an.group(), '全为小写'
else:
print s1, "不全是小写!"
an = re.match('[a-z]+$', s2)
if an:
print 's2:', an.group(), '全为小写'
else:
print s2, "不全是小写!"
Copyright© 2013-2020
All Rights Reserved 京ICP备2023019179号-8