Thursday, June 19, 2014

World Cup Python One-Liner

https://gist.github.com/fmasanori/1288160dad16cc473a53



If you don't count imports:

import urllib2, json
print '\n'.join([' '.join((jogo['home_team']['country'], str(jogo['home_team']['goals']), 'x', jogo['away_team']['country'], str(jogo['away_team']['goals']))) for jogo in json.loads(urllib2.urlopen('http://worldcup.sfg.io/matches').read().decode('utf-8')) if jogo['status'] == 'completed'])

No comments:

Post a Comment