Created
June 20, 2014 02:32
-
-
Save masakichi/bbe3b3d3ee5f5aecd7d5 to your computer and use it in GitHub Desktop.
World Cup in one line.
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 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']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
修改下import, 用requests吧, 还免得显式import json了.
如果写成python -c更好玩.