operationsto custom tree walkersto general-purpose frameworks in this and the next sectionwe'll explore each option in turnjust as did while refining solutions to this real-world dilemma greps and globs and finds if you work on unix-like systemsyou probably already know that there is standard way to search files for strings on such platforms--the command-line program grep and its relatives list all lines in one or more files containing string or string pattern |given that shells expand ( "glob"filename patterns automaticallya command such as the following will search single directory' python files for string named on the command line (this uses the grep command installed with the cygwin unix-like system for windows that described in the prior :\pp \system\filetoolsc:\cygwin\bin\grep exe walk py bigext-tree py:for (thisdirsubsherefilesherein os walk(dirname)bigpy-path pyfor (thisdirsubsherefilesherein os walk(srcdir)bigpy-tree py:for (thisdirsubsherefilesherein os walk(dirname)as we've seenwe can often accomplish the same within python script by running such shell command with os system or os popen and if we search its results manuallywe can also achieve similar results with the python glob module we met in it expands filename pattern into list of matching filename strings much like shellc:\pp \system\filetoolspython import os for line in os popen( ' :\cygwin\bin\grep exe walk py')print(lineend=''bigext-tree py:for (thisdirsubsherefilesherein os walk(dirname)bigpy-path pyfor (thisdirsubsherefilesherein os walk(srcdir)bigpy-tree py:for (thisdirsubsherefilesherein os walk(dirname)from glob import glob for filename in glob('py')if 'walkin open(filenameread()print(filenamebigext-tree py bigpy-path py bigpy-tree py unfortunatelythese tools are generally limited to single directory glob can visit multiple directories given the right sort of pattern stringbut it' not general directory walker of the sort need to maintain large examples tree on unix-like systemsa find shell command can go the extra mile to traverse an entire directory tree for |in factthe act of searching files often goes by the colloquial name "greppingamong developers who have spent any substantial time in the unix ghetto complete system programs