473,385 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 965
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: A. B., Khalid | last post by:
Hello all. After the effort of getting most of Python 2.3.4 Final compiled in MinGW (see: http://mail.python.org/pipermail/python-list/2004-June/225967.html, and get the patch and read more...
7
by: Jorgen Grahn | last post by:
I have a set of tests in different modules: test_foo.py, test_bar.py and so on. All of these use the simplest possible internal layout: a number of classes containing test*() methods, and the good...
8
by: Jimnbigd | last post by:
What is the recommended code to test browser type, for conditional processing in Javascript? I have seen tests for "document.all". I have seen tests for the actual browser name, or substrings in...
3
by: TPJ | last post by:
"The advantage of xrange() over range() is minimal (since xrange() still has to create the values when asked for them) except when a very large range is used on a memory-starved machine or when all...
1
by: travislspencer | last post by:
Hey All, I am trying to write a script that runs all of my pyunit tests for me. Ideally, I would like to be able to drop a new module into my project's test subdirectory, and the testing script...
3
by: Julie | last post by:
Does anyone know of a forum for discussing the writing of fit tests? I have a couple of questions that haven't been answered in the typical open source way (look at the source stupid). Barring...
16
by: Greg Roberts | last post by:
Hi I want to place the tests needed in the code using attributes. There seems to be enough code snippets around for me to cover this. e.g. // Test cases, run these here on the function and...
2
by: um | last post by:
When the POSIX pthreads library for w32 release 2-2-0 (http://sources.redhat.com/pthreads-win32/) is compiled with VC++6 then it compiles and passes all the benchmark tests in the subdirectory...
6
by: Ben Finney | last post by:
Howdy all, Summary: I'm looking for idioms in unit tests for factoring out repetitive iteration over test data. I explain my current practice, and why it's unsatisfactory. When following...
5
by: =?Utf-8?B?cmFuZHkxMjAw?= | last post by:
I'm working in Visual Studio 2005 Team Edition for Software Developers I've used the wizard under the Test menu to create a bunch of unit tests. When I click "Test -Start Selected Test Project...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.