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?
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