【发布时间】:2015-12-19 11:14:13
【问题描述】:
我需要帮助从 - https://www.udemy.com/api-2.0/channels/1640/courses?is_angular_app=true&p=2 中提取“url”值
import urllib2, json
response = urllib2.urlopen('https://www.udemy.com/api-2.0/channels/1640/courses?is_angular_app=true&p=2')
data = json.load(response)
for data["url"] in data.items():
print data["url"]
上面不行。请帮忙
【问题讨论】:
-
检查这个:响应返回一个 JSON 字典,没有数组,也没有属性 'url' - 但是,响应包含属性 'result',它存储了一个具有 url 属性的课程对象数组。因此,您可以迭代 results 属性而不是整个响应。
标签: json angularjs python-2.7 parsing