On 2015-11-12 15:56, Peter Otten wrote: > Tim Chase wrote: > > > with open("file1.md5") as a, open("file2.md5") as b: > > for s1, s2 in zip(a, b): > > if s1 != s2: > > print("Files differ") > > Note that this will not detect extra lines in one of the files. > I recommend that you use itertools.zip_longest (izip_longest in > Python 2) instead of the built-in zip().
Yeah, I noticed that after pushing <send> but then posted a later version that just read chunks of the file which should catch that file-size difference. Or, as in that other message, prefix it with an fstat() check to compare file-sizes so that you don't even have to open the files if the sizes differ. -tkc -- https://mail.python.org/mailman/listinfo/python-list