We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

The filecmp module

(New in 2.0) This module contains functions to compare files and directories.

Example: Using the filecmp module
# File: filecmp-example-1.py

import filecmp

if filecmp.cmp("samples/sample.au", "samples/sample.wav"):
    print "files are identical"
else:
    print "files differ!"

files differ!

In 1.5.2 and earlier, you can use the cmp and dircmp modules instead.