print("Hello, welcome to password strength. Test how strong your password is todai!")
password = input("Well enter a password why don't you... ")
print("So your password is", password)
print("Well ok, let's see what i can understand from this...")
if len(password) < 6:
print("Your password is too short")
else:
print("Your password is of a good length")
if password == password.upper():
print("Your password has too many uppercase letters")
else:
print("Your password has 0 or a couple upper case letters, please consider making your password remember-able.")
if password == password.lower():
print("Your password needs a upper case letter case letters")
else:
print("Your password has a suitable amount of lowercase vs upper case letters")
if password ==
这是我想问密码是否只包含数字的地方,但我不知道该怎么做,我已经尝试过使用 ands 和 ors,但失败得很惨。
最佳答案
使用isdigit()
>>> "abcd123".isdigit()
False
>>> "123".isdigit()
True
关于python - 检查字符串是否只包含一些值,而不包含其他值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27058723/