import urllib2
response = urllib2.urlopen('http://api.xyz.com')
html = response.read()
http://api.xyz.comで
{
"responseHeader":{
"status":0,
"QTime":18,
"params":{
"indent":"on",
"q":"",
"wt":"json",}},
"response":{"numFound":7984,"start":0,"maxScore":1.0,"docs":[
{
"id":"21",
"first_name":"anurag"
},
{
"id":"31",
"first_name":"abhishek"
}
]
}
問題は、この URL が json 出力を返すことです。そのjsonファイルを読みたいのですが、エラーが表示されています:文字列インデックスはstrではなく整数でなければなりません。