In my program, Python opens a CSV Excel file and reads it. The file contains alphanumeric data, separated into three different cells in the Excel file. The program then makes the data a list.
The program should sort the list by the numerical data, highest to lowest. But I have been not able to find a solution for this.
So far I have:
def highlow ():
file = open("Thisfile.csv", "r" )
read = file.readlines ()
list(read)
I've tried:
read.sort ()
But when I print 'read' all I get is:
['ANDERSON,Jane,7\n', 'BIRCH,Darren,9\n', 'MCKOLEEP,Philip,6\n', 'SMITH,Richard,3\n']
Instead I wanted the list sorted by the integer in each item, instead of alphabetically.