def scoreboard(PLAYER, SCORE, scoresPerPlayer): with open('score.csv', 'r+',) as file: scoreObject = csv.reader(file) for row in scoreObject: scoresPerPlayer.append(row) for item in scoresPerPlayer: if PLAYER in item: item.append(SCORE) if row in scoreObject == False: scoresPerPlayer.append([PLAYER,SCORE]) scoreObject = csv.writer(file) scoreObject.writerow(scoresPerPlayer)