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

Re: basic comparing files

P: n/a
En Thu, 15 May 2008 06:02:29 -0300, Beema shafreen
<be************@gmail.comescribió:
I am comparing two files A and B
which has three columns a1, b1 of A and a2, b2
*three* columns? You menction only two of them.
say for example if need to compare a1 with a2 and if there are common i
have
display a1, b1, b2
or else i have to display a1 , b1 or a1, b2
Do you have to syncrhonize both listings? That is, search for matches that
are not in the same line? Or just compare line by line?
In the first case, the difflib module may help:
http://docs.python.org/lib/module-difflib.html
In the second case, just iterate over both files, compare lines and
display one thing or another.
is the set function going to be the best option or is there any other way
Probably the set type won't be useful - a concrete example of what you
want would help to provide better ideas.

--
Gabriel Genellina

Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.