472,119 Members | 935 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

tests

Hi, everyone.Does anybody have an idea how can i test two xls files for
equality with Python
Aug 9 '07 #1
5 919
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
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
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

<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
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.

Similar topics

reply views Thread by A. B., Khalid | last post: by
7 posts views Thread by Jorgen Grahn | last post: by
8 posts views Thread by Jimnbigd | last post: by
3 posts views Thread by TPJ | last post: by
1 post views Thread by travislspencer | last post: by
16 posts views Thread by Greg Roberts | last post: by
6 posts views Thread by Ben Finney | last post: by
5 posts views Thread by =?Utf-8?B?cmFuZHkxMjAw?= | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.