Okay so I'm having some troubles. I have a file with a few keywords in there. I have another file for the output.
I am trying to read each line from the first file, add a string at the end and the output to the last file.
Here's what I currently have:
def add(x, extend, file):
extend = Extl
file = open(file, "a")
for i in extend:
out = x + i + " + roy"
file.write(out + "\n")
file.close()
print("Starting...")
Extl = ['c', 's', 'aa', 'aqe','tdd', 'lap', 'tre', 'bgh', 'r' ]
Keys = []
Reader = open("Keywords.txt", "r")
for line in Reader:
Keys.append(line)
S = 0
while S < len(Keys):
xc = Keys[S]
files = "File.txt"
add(xc, Extl, files)
S += 1
However when I receive the output, I get something like this:
Keypeo
c + roy
Keypeo
s + roy
Keypeo
aa + roy
Keypeo
aqe + roy
Keypeo
tdd + roy
Keypeo
lap + roy
Keypeo
tre + roy
Keypeo
bgh + roy
Keypeo
r + roy
Aewqc + roy
Aewqs + roy
Aewqaa + roy
Aewqaqe + roy
Aewqtdd + roy
Aewqlap + roy
Aewqtre + roy
Aewqbgh + roy
Aewqr + roy
It's not adding the keywords correctly, only the last few are fine.
Help would be much appreciated.