File Compare with difflib.context_diff

Emile van Sebille emile at fenx.com
Thu Mar 19 00:02:42 CET 2009


JohnV wrote:
  > What I want to do is compare the old data (lets day it is saved to a
> file called 'lastdata.txt') with the new data (lets day it is saved to
> a file called 'currentdata.txt') and save the new appended data to a
> variable 

You may get away with something like: (untested)

newdata=open('currentdata.txt').read()[len(open('lastdata.txt').read()):]

HTH,

Emile




More information about the Python-list mailing list