| Python Library Reference |
Thefilecmp module defines functions to compare files anddirectories, with various optional time/correctness trade-offs.
Thefilecmp module defines the following functions:
1 ifthey seem equal,0 otherwise.Unlessshallow is given and is false, files with identicalos.stat() signatures are taken to be equal. Ifuse_statcache is given and is true,statcache.stat() will be called rather thenos.stat(); the default is to useos.stat().
Files that were compared using this function will not be compared againunless theiros.stat() signature changes. Note that usinguse_statcache true will cause the cache invalidation mechanism to fail -- the stale stat value will be used fromstatcache's cache.
Note that no external programs are called from this function, giving itportability and efficiency.
Thecommon parameter is a list of file names found in both directories.Theshallow anduse_statcache parameters have the samemeanings and default values as forfilecmp.cmp().
Example:
>>> import filecmp>>> filecmp.cmp('libundoc.tex', 'libundoc.tex')1>>> filecmp.cmp('libundoc.tex', 'lib.tex')0| Python Library Reference |