Skip to content

Instantly share code, notes, and snippets.

@thomasjk10
Last active October 4, 2016 16:12
Show Gist options
  • Save thomasjk10/5d827e4ef06f99f72167b94f6518b67d to your computer and use it in GitHub Desktop.
Save thomasjk10/5d827e4ef06f99f72167b94f6518b67d to your computer and use it in GitHub Desktop.
Using Json and Python
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