自编代码:
print 'Please set your passwords:',
passwd = raw_input()
passlen = len(passwd)
str1 = list(r'''`!@#$%^&*()_+-=/*{}[]\|'";:/?,.<>''')
str2 = [str(i) for i in range(0,10)]
str3 = [chr(i) for i in range(97,123)] + [chr(i) for i in range(65,91)]
#contain speacial special charater
spech = False
for each in str1:
if each in passwd:
spech = True
break
#contain number
num = False
for each in str2:
if each in passwd:
num = True
break
#contain speacial letter
lett= False
for each in str3:
if each in passwd:
lett = True
break
if passlen <= 8 or passwd.isdigit() or passwd.isalpha():
print 'The Security Level is Low'
elif passlen >= 16 and spech and num and lett:
print 'The Security Level is High'
elif spech and (not num) and (not lett):
print "what's wrong with you?"
else:
print 'The Security Level is Middle'