I have a txt file with data like this:
(NAME|RANGE|PASSANGERS)
Airbus A330-200|12000|263
Airbus A321-200|4600|200
Airbus A320-200|5500|162
Airbus A319-100|5700|132
Embraer 190|4445|106
ATR 72-600|1529|70
and i need to compare the number in the second column between every line and then print the NAME of the plane with the higher RANGE number (Need to print the NAME but have to compare and order it from highest RANGE to lowest RANGE). So far i have this:
f = open("./dados/aeronaves.txt","r")
d=[]
c=[]
tempList=[]
for line in f:
a =(line.strip().split('|'))
b = c.append(a)
d.append(int(a[1]))
d.sort()
for i in range(0,len(c)):
print(c[i])
print(c[i][1])
f.close()
but i dont know how to do it with the for in range but it has to be with it...
HELP