I would like to read from a csv file and add certain things to a list
JFK,John F Kennedy International,5326,5486
ORY,Paris-Orly,629,379
MAD,Adolfo Suarez Madrid-Barajas,1428,1151
AMS,Amsterdam Schiphol,526,489
CAI,Cairo International,3779,3584
Everything in the text file is listed above, I'd like to get the first from every line, so JFK ORY MAD AMS CAI added to a list.
I tried:
with open('Airports.txt', 'r') as f:
reader = csv.reader(f)
amr_csv = list(reader)
But this adds the whole text file to the list, and I couldn't get my head around adding it to only the first line
In summary, i'd like help on adding the first line of this text file to a list which is saved as a variable.
OUTPUT:
Thank you for anyone who offered help, this is what I ended up settling on as it was what i was looking for, hope this helps anyone with any similar question.