The filecmp Module

(New in 2.0) The filecmp module, shown in Example 14-4, contains functions to compare files and directories.

Example 14-4. Using the filecmp Module

import filecmp

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

# files differ!

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

Core Modules

More Standard Modules

Threads and Processes

Data Representation

File Formats

Mail and News Message Processing

Network Protocols


Multimedia Modules

Data Storage

Tools and Utilities

Platform-Specific Modules

Implementation Support Modules

Other Modules

Python Standard Library
Python Standard Library (Nutshell Handbooks) with
ISBN: 0596000960
EAN: 2147483647
Year: 2000
Pages: 252
Authors: Fredrik Lundh © 2008-2020.
If you may any questions please contact us: