Last active
October 4, 2016 16:12
-
-
Save thomasjk10/5d827e4ef06f99f72167b94f6518b67d to your computer and use it in GitHub Desktop.
Using Json and Python
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 json | |
import urllib | |
url = raw_input('Enter URL:') | |
input = urllib.urlopen(url) | |
data = input.read() | |
info = json.loads(data) | |
print info | |
sum_cnt = 0 | |
print info[0]['comments'] | |
for item in info[0]['comments']: | |
add_2sum = item['count'] | |
sum_cnt = sum_cnt + add_2sum | |
print sum_cnt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment