How can I compare if 2 files has duplicate entries in python?

Y

yinglcs

I am new to python. How can I compare if 2 files has duplicate entries
in python?
Is there an example for that? What if the files are big and I don't
want to read the whole file in memory.

Thank you.
 
L

Larry Bates

I am new to python. How can I compare if 2 files has duplicate entries
in python?
Is there an example for that? What if the files are big and I don't
want to read the whole file in memory.

Thank you.

You need to supply more info. If you just want to determine if two
files are exactly alike you can just calculate the md5 checksum or
each file. If they are different, the files are different. See:

http://docs.python.org/lib/module-md5.html


If you want to compare files line by line see following:

http://docs.python.org/lib/module-difflib.html


-Larry Bates
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top