import itertools
import string
file = open('list.txt', 'w')
def guess_password(real):
chars = string.ascii_lowercase + string.digits
attempts = 0
for password_length in range(1, 9):
for guess in itertools.product(chars, repeat=password_length):
attempts += 1
guess = ''.join(guess)
if guess == real:
return 'password is {}. found in {} guesses.'.format(guess, attempts)
print(guess)
file.write(guess + attempts # Unexpected indent error... WHY?!
print(guess_password('your password'))
command = input("()")
我评论了调用错误的位置。我正在尝试制作一个程序,给我一个可能的密码列表,并将它们放入记事本文件中
完整的错误回溯如下:文件“Pass_Crack_List.py”,第16行file.write(猜测+尝试)#Unexpected indent error ..,为什么?!TabError:缩进中不一致使用制表符和空格
此外,我试图退格直到前一行,然后按Enter键,错误仍然存在
错误已得到修复。它给我的错误3行太晚了(实际上是第13行)。