擅长:python、mysql、java
<p>您可以使用正则表达式简单地执行此操作,它将很好地工作:</p>
<pre><code>import re
password = input("Input your password: ")
if (re.match(r"^.*[A-Z]", password) and re.match(r"^.*[0-9]", password) and len(password)>7 and re.match(r"^.*[a-z]", password) ):
print("Password is strong enough")
else:
print("Password is not strong enough")
</code></pre>