diff options
author | R David Murray <rdmurray@bitdance.com> | 2012-08-15 01:40:13 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2012-08-15 01:40:13 (GMT) |
commit | 2b209cd78d5a36d63b00d0a4350b78aec7bc820b (patch) | |
tree | 9f8fff936fe93871204896a6dc452e5b00d9d9ff /Doc/library/filecmp.rst | |
parent | a17ef14632002172f9e957cf9bc3f379fa15663b (diff) | |
download | cpython-2b209cd78d5a36d63b00d0a4350b78aec7bc820b.zip cpython-2b209cd78d5a36d63b00d0a4350b78aec7bc820b.tar.gz cpython-2b209cd78d5a36d63b00d0a4350b78aec7bc820b.tar.bz2 |
#15269: document dircmp.left and right, and add tests for them.
Patch by Chris Jerdonek.
Diffstat (limited to 'Doc/library/filecmp.rst')
-rw-r--r-- | Doc/library/filecmp.rst | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Doc/library/filecmp.rst b/Doc/library/filecmp.rst index f84cfa9..de20fb1 100644 --- a/Doc/library/filecmp.rst +++ b/Doc/library/filecmp.rst @@ -106,6 +106,16 @@ The :class:`dircmp` class to compute are used. + .. attribute:: left + + The directory *a*. + + + .. attribute:: right + + The directory *b*. + + .. attribute:: left_list Files and subdirectories in *a*, filtered by *hide* and *ignore*. @@ -169,3 +179,18 @@ The :class:`dircmp` class A dictionary mapping names in :attr:`common_dirs` to :class:`dircmp` objects. + +Here is a simplified example of using the ``subdirs`` attribute to search +recursively through two directories to show common different files:: + + >>> from filecmp import dircmp + >>> def print_diff_files(dcmp): + ... for name in dcmp.diff_files: + ... print("diff_file %s found in %s and %s" % (name, dcmp.left, + ... dcmp.right)) + ... for sub_dcmp in dcmp.subdirs.values(): + ... print_diff_files(sub_dcmp) + ... + >>> dcmp = dircmp('dir1', 'dir2') + >>> print_diff_files(dcmp) + |