Thefilecmp module defines functions to compare files anddirectories, with various optional time/correctness trade-offs.
Thefilecmp module defines the following functions:
| f1, f2[, shallow]) |
True ifthey seem equal,False otherwise.Unlessshallow is given and is false, files with identicalos.stat() signatures are taken to be equal.
Files that were compared using this function will not be compared againunless theiros.stat() signature changes.
Note that no external programs are called from this function, giving itportability and efficiency.
| dir1, dir2, common[, shallow]) |
Thecommon parameter is a list of file names found in both directories.Theshallow parameter has the samemeaning and default value as forfilecmp.cmp().
Example:
>>> import filecmp>>> filecmp.cmp('libundoc.tex', 'libundoc.tex')True>>> filecmp.cmp('libundoc.tex', 'lib.tex')False