#------------------------------------------------------------------------------ # File3.py #------------------------------------------------------------------------------ # main() ---------------------------------------------------------------------- def main(): f = open('Matrix.py') # open a connection to file in the file system content = f.read() # reads entire file as a string f.close() # close connection words = content.split() print() print("There are {0} words in the file.".format(len(words))) print() #words.sort() print(words) print() g = open('Matrix.py.bak', 'w') g.write(content) g.close() # end main() ------------------------------------------------------------------ # ----------------------------------------------------------------------------- if __name__=='__main__': main() # end if ----------------------------------------------------------------------