📄 dircmp-objects.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>6.7.1 The dircmp class </title>
<META NAME="description" CONTENT="6.7.1 The dircmp class ">
<META NAME="keywords" CONTENT="lib">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" href="lib.css" tppabs="http://www.python.org/doc/current/lib/lib.css">
<LINK REL="previous" href="module-filecmp.html" tppabs="http://www.python.org/doc/current/lib/module-filecmp.html">
<LINK REL="up" href="module-filecmp.html" tppabs="http://www.python.org/doc/current/lib/module-filecmp.html">
<LINK REL="next" href="module-popen2.html" tppabs="http://www.python.org/doc/current/lib/module-popen2.html">
</head>
<body>
<DIV CLASS="navigation"><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-filecmp.html" tppabs="http://www.python.org/doc/current/lib/module-filecmp.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="module-filecmp.html" tppabs="http://www.python.org/doc/current/lib/module-filecmp.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A href="module-popen2.html" tppabs="http://www.python.org/doc/current/lib/module-popen2.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="module-filecmp.html" tppabs="http://www.python.org/doc/current/lib/module-filecmp.html">6.7 filecmp </A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-filecmp.html" tppabs="http://www.python.org/doc/current/lib/module-filecmp.html">6.7 filecmp </A>
<b class="navlabel">Next:</b> <a class="sectref" href="module-popen2.html" tppabs="http://www.python.org/doc/current/lib/module-popen2.html">6.8 popen2 </A>
<br><hr></DIV>
<!--End of Navigation Panel-->
<H2>
<BR>
6.7.1 The <tt class="class">dircmp</tt> class
</H2>
<P>
<dl><dt><b><a name='l2h-1101'><tt class='class'>dircmp</tt></a></b> (<var>a, b</var><big>[</big><var>, ignore</var><big>[</big><var>, hide</var><big>]</big><big>]</big>)
<dd>
Construct a new directory comparison object, to compare the
directories <var>a</var> and <var>b</var>. <var>ignore</var> is a list of names to
ignore, and defaults to <code>['RCS', 'CVS', 'tags']</code>. <var>hide</var> is a
list of names to hid, and defaults to <code>[os.curdir, os.pardir]</code>.
</dl>
<P>
<dl><dt><b><a name='l2h-1102'><tt class='method'>report</tt></a></b> ()
<dd>
Print (to <code>sys.stdout</code>) a comparison between <var>a</var> and <var>b</var>.
</dl>
<P>
<dl><dt><b><a name='l2h-1103'><tt class='method'>report_partial_closure</tt></a></b> ()
<dd>
Print a comparison between <var>a</var> and <var>b</var> and common immediate
subdirctories.
</dl>
<P>
<dl><dt><b><a name='l2h-1104'><tt class='method'>report_full_closure</tt></a></b> ()
<dd>
Print a comparison between <var>a</var> and <var>b</var> and common
subdirctories (recursively).
</dl>
<P>
<dl><dt><b><a name='l2h-1105'><tt class='member'>left_list</tt></a></b>
<dd>
Files and subdirectories in <var>a</var>, filtered by <var>hide</var> and
<var>ignore</var>.
</dl>
<P>
<dl><dt><b><a name='l2h-1106'><tt class='member'>right_list</tt></a></b>
<dd>
Files and subdirectories in <var>b</var>, filtered by <var>hide</var> and
<var>ignore</var>.
</dl>
<P>
<dl><dt><b><a name='l2h-1107'><tt class='member'>common</tt></a></b>
<dd>
Files and subdirectories in both <var>a</var> and <var>b</var>.
</dl>
<P>
<dl><dt><b><a name='l2h-1108'><tt class='member'>left_only</tt></a></b>
<dd>
Files and subdirectories only in <var>a</var>.
</dl>
<P>
<dl><dt><b><a name='l2h-1109'><tt class='member'>right_only</tt></a></b>
<dd>
Files and subdirectories only in <var>b</var>.
</dl>
<P>
<dl><dt><b><a name='l2h-1110'><tt class='member'>common_dirs</tt></a></b>
<dd>
Subdirectories in both <var>a</var> and <var>b</var>.
</dl>
<P>
<dl><dt><b><a name='l2h-1111'><tt class='member'>common_files</tt></a></b>
<dd>
Files in both <var>a</var> and <var>b</var>
</dl>
<P>
<dl><dt><b><a name='l2h-1112'><tt class='member'>common_funny</tt></a></b>
<dd>
Names in both <var>a</var> and <var>b</var>, such that the type differs between
the directories, or names for which <tt class="function">os.stat()</tt> reports an
error.
</dl>
<P>
<dl><dt><b><a name='l2h-1113'><tt class='member'>same_files</tt></a></b>
<dd>
Files which are identical in both <var>a</var> and <var>b</var>.
</dl>
<P>
<dl><dt><b><a name='l2h-1114'><tt class='member'>diff_files</tt></a></b>
<dd>
Files which are in both <var>a</var> and <var>b</var>, whose contents differ.
</dl>
<P>
<dl><dt><b><a name='l2h-1115'><tt class='member'>funny_files</tt></a></b>
<dd>
Files which are in both <var>a</var> and <var>b</var>, but could not be
compared.
</dl>
<P>
<dl><dt><b><a name='l2h-1116'><tt class='member'>subdirs</tt></a></b>
<dd>
A dictionary mapping names in <tt class="member">common_dirs</tt> to
<tt class="class">dircmp</tt> objects.
</dl>
<P>
Note that via <tt class="method">__getattr__()</tt> hooks, all attributes are
computed lazilly, so there is no speed penalty if only those
attributes which are lightweight to compute are used.
<DIV CLASS="navigation"><p><hr><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-filecmp.html" tppabs="http://www.python.org/doc/current/lib/module-filecmp.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="module-filecmp.html" tppabs="http://www.python.org/doc/current/lib/module-filecmp.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A href="module-popen2.html" tppabs="http://www.python.org/doc/current/lib/module-popen2.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="module-filecmp.html" tppabs="http://www.python.org/doc/current/lib/module-filecmp.html">6.7 filecmp </A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-filecmp.html" tppabs="http://www.python.org/doc/current/lib/module-filecmp.html">6.7 filecmp </A>
<b class="navlabel">Next:</b> <a class="sectref" href="module-popen2.html" tppabs="http://www.python.org/doc/current/lib/module-popen2.html">6.8 popen2 </A>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>See <i><a href="about.html" tppabs="http://www.python.org/doc/current/lib/about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -