import sysospprint if sys platform[: ='win'dirname ' :\python \libelsedirname '/usr/lib/pythonallsizes [for (thisdirsubsherefilesherein os walk(dirname)for filename in fileshereif filename endswith(py')fullname os path join(thisdirfilenamefullsize os path getsize(fullnameallsizes append((fullsizefullname)allsizes sort(pprint pprint(allsizes[: ]pprint pprint(allsizes[- :]find the largest python source file on the module import search path import sysospprint visited {allsizes [for srcdir in sys pathfor (thisdirsubsherefilesherein os walk(srcdir)thisdir os path normpath(thisdirif thisdir upper(in visitedcontinue elsevisited[thisdir upper()true for filename in fileshereif filename endswith(py')pypath os path join(thisdirfilenametrypysize os path getsize(pypathexceptprint('skipping'pypathallsizes append((pysizepypath)allsizes sort(pprint pprint(allsizes[: ]pprint pprint(allsizes[- :]sum columns in text file separated by commas filename 'data txtsums {for line in open(filename)cols line split(',' appendix dsolutions to end-of-part exercises