Created
June 29, 2009 15:12
-
-
Save drewconway/137644 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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