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.

 

A Django site. rendered by a django application. hosted by webfaction.