python 解析 json
#coding=utf=8
import urllib,json
url ='https://api.douban.com/v2/book/user/62855846/collections'
read = urllib.urlopen(url).read()
j = 0
titles=[]
atls=[]
images=[]
a = json.loads(read)
leng = int(a['total'])
for i in range(leng):
titles.append( a['collections'][j]['book']['title'])
atls.append(a['collections'][j]['book']['alt'])
images.append( a['collections'][j]['book']['images']['medium'])
j=j+1
print titles
print atls
print images
浙公网安备 33010602011771号