Skip to content

Instantly share code, notes, and snippets.

@drewconway
Created June 29, 2009 15:12
Show Gist options
  • Save drewconway/137644 to your computer and use it in GitHub Desktop.
Save drewconway/137644 to your computer and use it in GitHub Desktop.
import os
import sys
import csv
def get_players(path):
# Returns a list of player names from CSV file
reader=csv.reader(open(path,'U'),delimiter=',')
'''
players=[]
row_num=0
for row in reader:
if row_num<1:
# Ignore the column headers
row_num+=1
else:
# Player names are in the first column,
# so we add data from index 0
players.append(row[0])
'''
# A much more succint method for extracting the player names
# was suggested by Michael Bommarito @mjbommar and is used below
reader.next()
return [row[0] for row in reader]
player_file_path='NYG_DRAFT_PICKS.csv'
players=get_players(player_file_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment