quickwhat' the biggest python source file on your computerthis was the query innocently posed by student in one of my python classes because didn' know eitherit became an official exercise in subsequent classesand it provides good example of ways to apply python system tools for realistic purpose in this book reallythe query is bit vaguebecause its scope is unclear do we mean the largest python file in directoryin full directory treein the standard libraryon the module import search pathor on your entire hard drivedifferent scopes imply different solutions scanning the standard library directory for instanceexample - is first-cut solution that looks for the biggest python file in one directory-- limited scopebut enough to get started example - pp \system\filetools\bigpy-dir py ""find the largest python source file in single directory search windows python source libunless dir command-line arg ""import osglobsys dirname ' :\python \libif len(sys argv= else sys argv[ allsizes [allpy glob glob(dirname os sep 'py'for filename in allpyfilesize os path getsize(filenameallsizes append((filesizefilename)allsizes sort(print(allsizes[: ]print(allsizes[- :]this script uses the glob module to run through directory' files and detects the largest by storing sizes and names on list that is sorted at the end--because size appears first in the list' tuplesit will dominate the ascending value sortand the largest percolates to the end of the list we could instead keep track of the currently largest as we gobut the list scheme is more flexible when runthis script scans the python standard library' source directory on windowsunless you pass different directory on the command lineand it prints both the two smallest and largest files it findsc:\pp \system\filetoolsbigpy-dir py [( ' :\\python \\lib\\build_class py')( ' :\\python \\lib\\struct py')[( ' :\\python \\lib\\turtle py')( ' :\\python \\lib\\decimal py') :\pp \system\filetoolsbigpy-dir py [( \\__init__ py')( \\bigpy-dir py') complete system programs