Hi there, I need help with the following code. I am trying to sort the list but only getting the last sentence of the file sorted. What am I doing wrong?
1 2 3 4 5 6 7 8 9 10 |
fname = input ( "Enter file name: " ) fh = open (fname) lst = list (fh) for line in lst: line = line.rstrip() print line y = line.split() k = y.sort() print y |