So I am trying to write a program to use a cypher to code a textfile. There is a textfile holding the cypher, and the program is supposed to ask the user which file they want encoded. This is my program so far
i keep getting "ValueError : need more than 1 value to unpack"
for line 4, (char, shadow_char) = line.split()
any help?
Code:
#program
textfile = input("What is the name of the file that holds a cypher?")
code = {}
for line in textfile:
(char, shadow_char) = line.split()
code[char]= shadow_char
infile = input("What is the name of the file that holds a text?")
outfile = input("Choose a name of a file where the encoded text should be printed?")
INFILE = open(infile, "r")
OUTFILE = open(outfile, "w")
for line in INFILE:
for char in sentence:
if char in code:
encoded_sentence += code[char]
else:
encoded_sentence += char
OUTFILE.write(sentence+ "\n")
OUTFILE.write(econded_sentence)
INFILE.close()
OUTFILE.close()
i keep getting "ValueError : need more than 1 value to unpack"
for line 4, (char, shadow_char) = line.split()
any help?
Comment