判断你设置的密码的强度

def judgePasswordStrength(password):
    strengthLength = max(0, len(password) - 5)
    from string import ascii_lowercase, ascii_uppercase, digits, punctuation
    flags = [bool(set(password) & set(s)) \
            for s in [ascii_lowercase, ascii_uppercase, digits, punctuation]]
    return min(flags.count(True), strengthLength)

  

posted @ 2016-11-18 12:45  想做土匪的书生  阅读(275)  评论(0编辑  收藏  举报