Movatterモバイル変換
[0]ホーム
11.5.1 Thedircmp class
dircmp instances are built using this constructor:
| class dircmp( | a, b[, ignore[, hide]]) |
- Construct a new directory comparison object, to compare thedirectoriesa andb.ignore is a list of names toignore, and defaults to
['RCS', 'CVS', 'tags'].hide is alist of names to hide, and defaults to[os.curdir, os.pardir].
Thedircmp class provides the following methods:
- Print (to
sys.stdout) a comparison betweena andb.
- Print a comparison betweena andb and common immediatesubdirectories.
- Print a comparison betweena andb and common subdirectories (recursively).
Thedircmp offers a number of interesting attributes that maybe used to get various bits of information about the directory treesbeing compared.
Note that via__getattr__() hooks, all attributes arecomputed lazily, so there is no speed penalty if only thoseattributes which are lightweight to compute are used.
- left_list
- Files and subdirectories ina, filtered byhide andignore.
- right_list
- Files and subdirectories inb, filtered byhide andignore.
- common
- Files and subdirectories in botha andb.
- left_only
- Files and subdirectories only ina.
- right_only
- Files and subdirectories only inb.
- common_dirs
- Subdirectories in botha andb.
- common_files
- Files in botha andb
- common_funny
- Names in botha andb, such that the type differs betweenthe directories, or names for whichos.stat() reports anerror.
- same_files
- Files which are identical in botha andb.
- diff_files
- Files which are in botha andb, whose contents differ.
- funny_files
- Files which are in botha andb, but could not becompared.
- subdirs
- A dictionary mapping names incommon_dirs todircmp objects.
Release 2.5.2, documentation updated on 21st February, 2008. SeeAbout this document... for information on suggesting changes.
[8]ページ先頭