Returns an error (IndexError: list index out of range on line 18) when trying to select the second element of a line from a cvs file
IndexError when trying to select the second element of a line from a CSV file Question: import csv list = [] with open(‘games.csv’, ‘r’) as csvfile: reader = csv.DictReader(csvfile) for row in reader: cond = int(row[‘white_rating’]) – int(row[‘black_rating’]) if -100 <= cond <= 100 and row[‘winner’] == ‘white’: move = str(row[‘moves’]) move = move.split()[0] list.append(move) …