{
    "mode": "pydoc",
    "parameter": "filecmp",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/filecmp/json",
    "generated": "2026-06-02T13:19:10Z",
    "sections": {
        "NAME": {
            "content": "filecmp - Utilities for comparing files and directories.\n",
            "subsections": []
        },
        "MODULE REFERENCE": {
            "content": "https://docs.python.org/3.10/library/filecmp.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Classes:\ndircmp\n\nFunctions:\ncmp(f1, f2, shallow=True) -> int\ncmpfiles(a, b, common) -> ([], [], [])\nclearcache()\n",
            "subsections": []
        },
        "CLASSES": {
            "content": "builtins.object\ndircmp\n",
            "subsections": [
                {
                    "name": "class dircmp",
                    "content": "|  dircmp(a, b, ignore=None, hide=None)\n|\n|  A class that manages the comparison of 2 directories.\n|\n|  dircmp(a, b, ignore=None, hide=None)\n|    A and B are directories.\n|    IGNORE is a list of names to ignore,\n|      defaults to DEFAULTIGNORES.\n|    HIDE is a list of names to hide,\n|      defaults to [os.curdir, os.pardir].\n|\n|  High level usage:\n|    x = dircmp(dir1, dir2)\n|    x.report() -> prints a report on the differences between dir1 and dir2\n|     or\n|    x.reportpartialclosure() -> prints report on differences between dir1\n|          and dir2, and reports on common immediate subdirectories.\n|    x.reportfullclosure() -> like reportpartialclosure,\n|          but fully recursive.\n|\n|  Attributes:\n|   leftlist, rightlist: The files in dir1 and dir2,\n|      filtered by hide and ignore.\n|   common: a list of names in both dir1 and dir2.\n|   leftonly, rightonly: names only in dir1, dir2.\n|   commondirs: subdirectories in both dir1 and dir2.\n|   commonfiles: files in both dir1 and dir2.\n|   commonfunny: names in both dir1 and dir2 where the type differs between\n|      dir1 and dir2, or the name is not stat-able.\n|   samefiles: list of identical files.\n|   difffiles: list of filenames which differ.\n|   funnyfiles: list of files which could not be compared.\n|   subdirs: a dictionary of dircmp instances (or MyDirCmp instances if this\n|     object is of type MyDirCmp, a subclass of dircmp), keyed by names\n|     in commondirs.\n|\n|  Methods defined here:\n|\n|  getattr(self, attr)\n|\n|  init(self, a, b, ignore=None, hide=None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  phase0(self)\n|\n|  phase1(self)\n|\n|  phase2(self)\n|\n|  phase3(self)\n|\n|  phase4(self)\n|\n|  phase4closure(self)\n|\n|  report(self)\n|\n|  reportfullclosure(self)\n|\n|  reportpartialclosure(self)\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  classgetitem = GenericAlias(...) from builtins.type\n|      Represent a PEP 585 generic type\n|\n|      E.g. for t = list[int], t.origin is list and t.args is (int,).\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  methodmap = {'common': <function dircmp.phase1>, 'commondirs': <funct...\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "clear_cache",
                    "content": "Clear the filecmp cache.\n"
                },
                {
                    "name": "cmp",
                    "content": "Compare two files.\n\nArguments:\n\nf1 -- First file name\n\nf2 -- Second file name\n\nshallow -- treat files as identical if their stat signatures (type, size,\nmtime) are identical. Otherwise, files are considered different\nif their sizes or contents differ.  [default: True]\n\nReturn value:\n\nTrue if the files are the same, False otherwise.\n\nThis function uses a cache for past comparisons and the results,\nwith cache entries invalidated if their stat information\nchanges.  The cache may be cleared by calling clearcache().\n"
                },
                {
                    "name": "cmpfiles",
                    "content": "Compare common files in two directories.\n\na, b -- directory names\ncommon -- list of file names found in both directories\nshallow -- if true, do comparison based solely on stat() information\n\nReturns a tuple of three lists:\nfiles that compare equal\nfiles that are different\nfilenames that aren't regular files.\n"
                }
            ]
        },
        "DATA": {
            "content": "DEFAULTIGNORES = ['RCS', 'CVS', 'tags', '.git', '.hg', '.bzr', 'darc...\nall = ['clearcache', 'cmp', 'dircmp', 'cmpfiles', 'DEFAULTIGNORE...\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3.10/filecmp.py\n\n",
            "subsections": []
        }
    },
    "summary": "filecmp - Utilities for comparing files and directories.",
    "flags": [],
    "examples": [],
    "see_also": []
}