file and directory handling note the attributes of dircmp object are evaluated lazily and not determined at the time the dircmp object is first created thusif you're interested in only some of the attributesthere' no added performance penalty related to the other unused attributes fnmatch the fnmatch module provides support for matching filenames using unix shell-style wildcard characters this module only performs filename matchingwhereas the glob module can be used to actually obtain file listings the pattern syntax is as followscharacter(sdescription [seq[!seqmatches everything matches any single character matches any character in seq matches any character not in seq the following functions can be used to test for wildcard matchfnmatch(filenamepatternreturns true or false depending on whether filename matches pattern case sensitivity depends on the operating system (and may be non-case-sensitive on certain platforms such as windowsfnmatchcase(filenamepatternperforms case-sensitive comparison of filename against pattern filter(namespatternapplies the fnmatch(function to all of the names in the sequence names and returns list of all names that match pattern examples fnmatch('foo gif''gif'returns true fnmatch('part html''part [ - html'returns false example of finding files in an entire directory tree using os walk()fnmatchand generators def findall(topdirpattern)for pathfilesdirs in os walk(topdir)for name in filesif fnmatch fnmatch(name,pattern)yield os path join(path,namefind all py files for pyfile in findall(","py")print pyfile lib fl ff