Created
June 25, 2016 20:16
-
-
Save bkabrda/bc166034299fc9bf28afed5323c4822d to your computer and use it in GitHub Desktop.
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
| import requests | |
| p = requests.get('https://petition.parliament.uk/petitions/131215.json').json() | |
| tuples = [(x['name'], x['signature_count']) | |
| for x in p['data']['attributes']['signatures_by_country']] | |
| tuples = sorted(tuples, key=lambda x: x[1]) | |
| counted = 0 | |
| for t in tuples: | |
| counted += t[1] | |
| print(t) | |
| print('Signature count: {}'.format(p['data']['attributes']['signature_count'])) | |
| print('Counted: {}'.format(counted)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment