【发布时间】:2015-09-18 14:31:31
【问题描述】:
我知道如何将用户输入保存到文本文件中,但我该如何加密呢?这是我将用户输入保存到文本文件的内容。我试过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 文档中阅读有关 File objects 的更多信息。 -
您是要加密密码保存到文件中,还是先保存密码到文件中再加密文件?
标签: python security encryption save python-3.4