我正在尝试加密一个文件,并将第一个文件中的加密文本保存到另一个文件中。我有它所有的工作,除了它只是写入一行到新的文件,而不是整个文件
file1 = open("passwords-plainText", "r")
for line in file1:
file2 = open("encryptedfile.txt", "w")
file2.write(encryptVignere(keyGen(), line))
我使用的示例文件如下所示
example
secondexample
new line
this is another new line
我保存到的新文件中的输出只写入第一行,而不写入其余的行 (即)
tyawakud
文件应该是这样的
tyawakud
tqiibwaeeonozp
pttzucfqs
foxnzgjwtmbhnpwhjnapmsfg
您应该只打开
file2
一次:否则,您将继续覆盖它
相关问题 更多 >
编程相关推荐