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.

 

[comment on/vote for this article]

A Django site. this page was rendered by a django application in 0.00s 2012-05-25 15:34:20.417084. hosted by webfaction.