第7章 强口令监测

#强口令监测
import re
def length(Password):
    if len(Password) < 8:
        print("the password is too short,please input again:")
        return False
    number = re.compile(r'\d+')
    if number.search(Password) == None:
        print("the password should contain number,please input again:")
        return False
    upletter = re.compile(r'[A-Z]+')
    if upletter.search(text) == None:
        print("the password should contain upper,please input again:")
        return False
    lowletter = re.compile(r'[a-z]+')
    if lowletter.search(text) == None:
        print("the password should contain lower,please input again:")
        return False
    return True

while True:
    text = input("please input password:")
    flag = length(text)
    if flag:
        print('the password is legal!')
        break
    else:
        continue

猜你喜欢

转载自blog.csdn.net/baidu_27361307/article/details/80733633