(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/module-cmpcache.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/allos.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/module-statvfs.html| ]]
|
Python Library Reference
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/contents.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/modindex.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/genindex.html| ]]
|
Next: 6.8 cmpcache Up: 6. Generic Operating System Previous: 6.6 statvfs
6.7 cmp -- File comparisons
The cmp module defines a function to compare files, taking all sort of short-cuts to make it a highly efficient operation.
The cmp module defines the following function:
- cmp (f1, f2)
- Compare two files given as names. The following tricks are used to optimize the comparisons:
- Files with identical type, size and mtime are assumed equal.
- Files with different type or size are never equal.
- The module only compares files it already compared if their signature (type, size and mtime) changed.
- No external programs are called.
Example:
>>> import cmp
>>> cmp.cmp('libundoc.tex', 'libundoc.tex')
1
>>> cmp.cmp('libundoc.tex', 'lib.tex')
0
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/module-cmpcache.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/allos.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/module-statvfs.html| ]]
|
Python Library Reference
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/contents.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/modindex.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/genindex.html| ]]
|
Next: 6.8 cmpcache Up: 6. Generic Operating System Previous: 6.6 statvfs
Send comments on this document to python-docs@python.org.