binary comparison of file object

Fredrik Lundh fredrik at pythonware.com
Mon Mar 12 17:25:09 EST 2001


Jaeho Lee wrote:
> I am trying to compare the contents of binary file. Checking if the files
> are same or not is enough.

use the filecmp module:

    result = filecmp.cmp(file1, file2, shallow=0)

for more info, see:

    http://www.python.org/doc/current/lib/module-filecmp.html

Cheers /F

<!-- pythonworks 1.2 coming soon:
http://www.pythonware.com/products/works/index.htm
-->





More information about the Python-list mailing list