By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,818 Members | 1,262 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,818 IT Pros & Developers. It's quick & easy.

tests

P: n/a
Hi, everyone.Does anybody have an idea how can i test two xls files for
equality with Python
Aug 9 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On Aug 9, 8:21 am, nikolay marinov <n.mari...@sistechnology.com>
wrote:
Hi, everyone.Does anybody have an idea how can i test two xls files for
equality with Python
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.

Mike

Aug 9 '07 #2

P: n/a
ky******@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?
Aug 9 '07 #3

P: n/a
On Aug 9, 4:04 pm, brad <byte8b...@gmail.comwrote:
kyoso...@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

Aug 9 '07 #4

P: n/a

<di************@gmail.comwrote in message
news:11**********************@r34g2000hsd.googlegr oups.com...
On Aug 9, 4:04 pm, brad <byte8b...@gmail.comwrote:
>kyoso...@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...
Aug 9 '07 #5

P: n/a
Steve Holden wrote:
This discussion seems to assume that Excel spreadsheets are stored in
some canonical form so that two spreads with the same functionality are
always identical on disk to the last bit. I very much doubt this is true
(consider as an example the file properties that can be set).

So really you need to define "equality". So far the tests discussed have
concentrated on identifying identical files.

regards
Steve
I was wondering myself if the OP was actually interested in binary identical
files, or just duplicated content. If just duplicated content, perhaps this
could be used as a starting point:

http://aspn.activestate.com/ASPN/Coo.../Recipe/440661

and the actual data can be compared

-Jay
Aug 9 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.