468,741 Members | 1,588 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,741 developers. It's quick & easy.

Re: basic comparing files

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
0 897

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Peteroid | last post: by
3 posts views Thread by s99999999s2003 | last post: by
3 posts views Thread by system55 | last post: by
97 posts views Thread by Master Programmer | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
xarzu
2 posts views Thread by xarzu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.