File Compare with difflib.context_diff

JohnV loftmaster at gmail.com
Thu Mar 19 12:28:18 EDT 2009


Here is the latest version of the code:

currentdata_file = r"C:\Users\Owner\Desktop\newdata.txt" # the latest
download from the clock
lastdata_file = r"C:\Users\Owner\Desktop\mydata.txt" # the prior
download from the clock
output_file = r"C:\Users\Owner\Desktop\out.txt" # will hold delta
clock data

newdata = open(currentdata_file).read()[len(open(lastdata_file).read
()):]
newdata2 = newdata.strip()


file = open(output_file, 'w')
file.write(newdata2)
file.close()


Do I need to close currentdata_file and lastdata_file ?

Have not gotten the os.stat example to work yet...
thanks for the help.



More information about the Python-list mailing list