tests

special_dragonfly Dominic at PLEASEASK.co.uk
Thu Aug 9 10:46:49 EDT 2007


<dijkstra.arjen at gmail.com> wrote in message 
news:1186670584.148181.180040 at r34g2000hsd.googlegroups.com...
> On Aug 9, 4:04 pm, brad <byte8b... at gmail.com> wrote:
>> kyoso... at gmail.com wrote:
>> > You should be able to read chunks of each file in binary mode and do a
>> > compare to check for equality. Some kind of loop should do the trick.
>>
>> Why not a simple md5 or sha with the hash library?
>
> Or even:
>
> http://docs.python.org/lib/module-filecmp.html
>

My understanding of reading that is that it only looks at the file names 
themselves and not their contents. So whether filename1=filename2 and in the 
case of the function below it, whether one directory has files which are in 
the other.
Correct me if I'm wrong.
Dom

P.S. md5 or sha hash is what I'd go for, short of doing:

MyFirstFile=file("file1.xls")
MySecondFile=file("file2.xls")
If MyFirstFile==MySecondFile:
    print "True"

although this won't tell you where they're different, just that they are... 





More information about the Python-list mailing list