Created
March 23, 2012 02:54
-
-
Save neilkod/2166367 to your computer and use it in GitHub Desktop.
alliteration.py
This file contains hidden or 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
#!/bin/python | |
import json, random | |
from collections import defaultdict | |
positions = defaultdict(list) | |
f = open('players.json','r').read() | |
data = json.loads(f) | |
players = data['body']['players'] | |
for player in players: | |
if player['firstname'][0] == player['lastname'][0]: | |
positions[player['position']].append(player) | |
for pos, players in positions.iteritems(): | |
player = random.choice(players) | |
print '\t'.join([pos, player['fullname'], player['pro_team']]) | |
nkodner@hadoop4 fope$ python alliteration.py | |
LF Brandon Burgess ARI | |
C Patrick Perry BOS | |
RP Christopher Cody MIL | |
DH Billy Butler KC | |
SS Eric Eymann CIN | |
OF Mikie Mahtook TB | |
SP Shawn Sanford SF | |
CF Mitch Maier KC | |
P Michael Marbry COL | |
RF Kevin Kiermaier TB | |
1B Craig Cooper SD | |
2B Buck Britton BAL | |
3B Brett Bonvechio SD | |
nkodner@hadoop4 fope$ python alliteration.py | |
LF Ryan Raburn DET | |
C Benjamin Blumenthal NYY | |
RP Sean H. Smith COL | |
DH Billy Butler KC | |
SS Nick Noonan SF | |
OF Abraham Almonte NYY | |
SP Juan Jaime ARI | |
CF Greg Golson KC | |
P Michael Marbry COL | |
RF Doug Deeds LAA | |
1B James Jurries ATL | |
2B Brock Bond SF | |
3B Scott Sizemore OAK | |
nkodner@hadoop4 fope$ python alliteration.py | |
LF Corey Coles CHC | |
C Chun Chen CLE | |
RP Richard Rundles STL | |
DH Billy Butler KC | |
SS Christain Colon KC | |
OF Abraham Almonte NYY | |
SP Billy Buckner COL | |
CF Chevy Clarke LAA | |
P Michael Marbry COL | |
RF Maximo Mendez SEA | |
1B Bryan Byrne ARI | |
2B Alfredo Amezaga CHC | |
3B Kody Kirkland HOU | |
nkodner@hadoop4 fope$ python alliteration.py | |
LF Casey Craig PHI | |
C Carlos Corporan HOU | |
RP Geoff Geary LAD | |
DH Randy Ruiz TOR | |
SS Brian Bocock TOR | |
OF Mikie Mahtook TB | |
SP Robbie Ross TEX | |
CF Billy Bell BOS | |
P Chance Chapman PHI | |
RF Jason James CHC | |
1B Mitch Moreland TEX | |
2B Marc Maddox KC | |
3B Scott Sizemore OAK | |
nkodner@hadoop4 fope$ python alliteration.py | |
LF Casey Craig PHI | |
C Jonathan Johnston OAK | |
RP Matt Meyer LAA | |
DH Randy Ruiz TOR | |
SS Carlos Colmenares LAA | |
OF Mikie Mahtook TB | |
SP Mark Mulder STL | |
CF Justin Justice DET | |
P Chance Chapman PHI | |
RF Gabe Gross SEA | |
1B Ryan Roberson DET | |
2B Carlo Cota TOR | |
3B Peter Pope ATL | |
nkodner@hadoop4 fope$ python alliteration.py | |
LF Chris Coghlan MIA | |
C Brian Bormaster TOR | |
RP Chad Cordero TOR | |
DH Billy Butler KC | |
SS Ryan Rohlinger COL | |
OF Mikie Mahtook TB | |
SP Josh Johnson MIA | |
CF Trayce Thompson CHW | |
P Bradley Boxberger SD | |
RF Maximo Mendez SEA | |
1B Michael McDade TOR | |
2B Craig Counsell MIL | |
3B Jorge Jimenez BOS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment