我在python上编写密码强度代码,我试图找出我的密码(p
)是否包含一个数字,我已经找到了如何查看它是否包含大小写字母p.isupper()
或者p.islower()
.我也把它们放在一起了.我的朋友告诉我如何查看密码是否只包含数字,但我现在需要你的帮助.
running=True
while running:
p=raw_input("What is your Password? ")
if len(p) <6:
print "Your Password is too short"
if len(p) >12:
print "Your Password is too long"
if len(p) == 6 or 7 or 8 or 9 or 10 or 11 or 12:
print "Password Length OK"
running=False
print "Loop Broken" #this will be deleted, only for my help now
if p.isupper():
print "Your Password is weak as it only contains capital letters"
if …
Run Code Online (Sandbox Code Playgroud)