On Tue, 28 Sep 2010 01:09:54 am Tim Miller wrote:
> def complex_password(password):
> """Checks password for sufficient complexity."""
> if len(password) < 12:
> return False
> if len([c for c in password if c in punctuation]) == 0:
> return False
> if len([c for c in password if c in digits]) == 0:
> return False
> if len([c for c in password if c in ascii_uppercase]) == 0:
> return False
> if len([c for c in password if c in ascii_lowercase]) == 0:
> return False
> return True
def complex_password(password):
return (
len(password) >= 12 and
any(c in punctuation for c in password) and
any(c in digits for c in password) and
any(c in ascii_uppercase for c in password) and
any(c in ascii_lowercase for c in password)
)
--
Steven D'Aprano
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor