The problem is that you are comparing each line in fileone
to the same line in filetwo
. As soon as there is an extra line in one file you will find that the lines are never equal again. Try this:
with open('old.csv', 'r') as t1, open('new.csv', 'r') as t2:
fileone = t1.readlines()
filetwo = t2.readlines()
with open('update.csv', 'w') as outFile:
for line in filetwo:
if line not in fileone:
outFile.write(line)