User Tools

Site Tools


compare

This is an old revision of the document!


To compare two files and update the orginal

  f = open("C:\\temp\old.csv", "r")
  lines = f.read()
  f.close() 
  f2 = open("C:\\temp\\new.csv", "r")
  cnt = 0
  for var in f2.readlines():
     f = open("C:\\temp\old.csv", "a")
     if var not in lines:
       cnt = cnt +1
       print(var)
       f.write(var)
  f.close()             	
  f2.close()

print(cnt, “ new transactions”)

compare.1525655660.txt.gz · Last modified: 2018/05/06 20:14 by zeppo