Python : Compare two csv files and print out differences
<p>I need to compare two CSV files and print out differences in a third CSV file.
In my case, the first CSV is a old list of hash named old.csv and the second CSV is the new list of hash which contains both old and new hash.</p>

<p>Here is my code :</p>

<pre><code>import csv
t1 = open('old.csv', 'r')
t2 = open('new.csv', 'r')
fileone = t1.readlines()
filetwo = t2.readlines()
t1.close()
t2.close()

outFile = open('update.csv', 'w')
x = 0
for i in fileone:
    if i != filetwo[x]:
        outFile.write(filetwo[x])
    x += 1
outFile.close()
</code></pre>

<p>The third file is a copy of the old one and not the update.
What's wrong ? I Hope you can help me, many thanks !! </p>

<p>PS : i don't want to use diff </p>