I am trying to find the difference between two csv file cell by cell. Following is the code I used however it uses set
s and treats unable to locate difference if there are two rows with the same exact value.
For example:
First csv:
bob virgnia 22
bob virgnia 22
adam virginia 21
jack california 22
Second csv:
bob virgnia 22
adam virgnia 21
jack california 22
It is outputting with no difference.
# Read in the original and new file
orig = open('T1.csv','r')
new = open('T2.csv','r')
#in new but not in orig
bigb = set(new) - set(orig)
# small = set(orig) - set(new)
# To see results in console if desired
print(bigb)
print()
# Write to output file
with open('different.csv', 'w') as file_out:
for line in bigb:
file_out.write(line)
#close the files
orig.close()
new.close()
file_out.close()