我想要帮助提取" url"价值来自 - https://www.udemy.com/api-2.0/channels/1640/courses?is_angular_app=true&p=2
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"]
它不起作用。请帮忙
答案 0 :(得分:0)
使用此代码,您可以获得第一个数组的URL
/^(\/path.+|(?!\/path).*)$/
使用for循环获取每个数组的所有网址
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)
print data['results'][0]['url']
答案 1 :(得分:0)
试试这个:
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 i in range(len(data['results'])):
print data['results'][i]['url']