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(猜测+尝试)#意外缩进错误..,为什么?!TabError:缩进中制表符和空格的用法不一致
此外,我还尝试退格键,直到上一行,然后按enter,错误仍然存在
已解决
错误已修复。它给出了错误3行太晚了(实际上是第13行)。
https://stackoverflow.com/questions/51228193
复制相似问题