我知道如何将用户的输入保存到文本文件中,但如何加密它呢?以下是我用于将用户输入保存到文本文件中的代码。我尝试过f.encrypt("Passwords_log.txt"
,但没有结果。
import time
password1 = input("Please type a password: ")
print("Your password has passed the verification!")
time.sleep(1)
print("Saving and encrypting password...")
time.sleep(2)
f=open("Passwords_log.txt",'a')
f.write(password)
f.write('\n')
f.close()
print("Done!")
file.encrypt
的? :) 你可以在 Python 文档中阅读有关 文件对象 的更多信息。 - André Laszlo