jarrod817
12/12/2015 - 3:54 AM

Coursera - Open website, read JSON code, count the numbers and print out the sum.

Coursera - Open website, read JSON code, count the numbers and print out the sum.

import urllib
import json
lst = list()
link = 'http://python-data.dr-chuck.net/comments_184200.json'
content = json.loads(urllib.urlopen(link).read())
for item in content['comments']:
    lst.append(item['count'])
print sum(lst)