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

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top