User Tools

Site Tools


compare

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.txt · Last modified: 2018/05/06 20:14 by zeppo