Aug-08-2018, 07:58 AM
Does unsorted_fruits.txt come from a different os?
test the line endings
test the line endings
import os padding = 20 file = '/unsorted_fruits.txt' if os.path.isfile(file): if "\r\n" in open(file,"r").read(): print (file.ljust(padding, " ")," : DOS line endings found") if "\n" in open(file,"r").read(): print (file.ljust(padding, " "), " : UNIX line endings found") if "\r" in open(file,"r").read(): print (file.ljust(padding, " ")," : MAC line endings found")