let' look next at some practical applications of string splits and joins in many domainsscanning files by columns is fairly common task for instancesuppose you have file containing columns of numbers output by another systemand you need to sum each column' numbers in pythonstring splitting is the core operation behind solving this problemas demonstrated by example - as an added bonusit' easy to make the solution reusable tool in python by packaging it as an importable function example - pp \lang\summer py #!/usr/local/bin/python def summer(numcolsfilename)sums [ numcols for line in open(filename)cols line split(for in range(numcols)sums[ +eval(cols[ ]return sums if __name__ ='__main__'import sys print(summer(eval(sys argv[ ])sys argv[ ])make list of zeros scan file' lines split up columns around blanks/tabs add numbers to sums 'summer py cols filenotice that we use file iterators here to read line by lineinstead of calling the file readlines method explicitly (recall from that iterators avoid loading the entire file into memory all at oncethe file itself is temporary objectwhich will be automatically closed when garbage collected as usual for properly architected scriptsyou can both import this module and call its functionand run it as shell tool from the command line the summer py script calls split to make list of strings representing the line' columnsand eval to convert column strings to numbers here' an input file that uses both blanks and tabs to separate columnsand the result of turning our script loose on itc:\pp \langtype table txt :\pp \langpython summer py table txt [ also notice that because the summer script uses eval to convert file text to numbersyou could really store arbitrary python expressions in the file herefor exampleit' run on file of python code snippetsc:\pp \langtype table txt + << eval(" " * * * pow( , text and language