用def创建函数,判断密码是否合法的函数(18位,大写字母,小写字母,数字组成)
import string
def judge(pas):
l = len(pas)
i1,i2,i3 = False, False, False
for alpha in pas:
if alpha in string.ascii_uppercase:
i1 = True
if alpha in string.ascii_lowercase:
i2 = True
if alpha in string.digits:
i3 = True
return l == 18 and i1 and i2 and i3
res = judge('abc23i33eeeee58o09')
print(res)
不知道你这个问题是否已经解决, 如果还没有解决的话: