1
例如,密碼可能具有以下所述的序列。 qwer,1234,1qaz,qwe,qaz,qwer, asd,asdf,wsx,wsx,2wsx,wer,asdf,1234,zxcv,5678。請問我寫一個簡單的python代碼來查看給出的密碼是否包含上述提到的序列python代碼來確定密碼是否包含序列
例如,密碼可能具有以下所述的序列。 qwer,1234,1qaz,qwe,qaz,qwer, asd,asdf,wsx,wsx,2wsx,wer,asdf,1234,zxcv,5678。請問我寫一個簡單的python代碼來查看給出的密碼是否包含上述提到的序列python代碼來確定密碼是否包含序列
您可以迭代並測試密碼中是否有文本。例如:
bad_strings = ["qwer", "1234", "1qaz", "qwe", "qaz", "qwer"]
passwords = ["blah347", "password1", "password2", "badqwer", "badqaz"]
def check_for_bad_password(password):
for bad_string in bad_strings:
if bad_string in password:
return password
for password in passwords:
if check_for_bad_password(password):
print(password)
此打印出badqwer
和badqaz
看到這裏http://stackoverflow.com/help/mcve如何提問。 – Guenther
Check out https://stackoverflow.com/questions/34582576/checking-a-string-for-adjacent-characters-on-the-keyboard – TimSC