get contents of url in python
<pre><code>import urllib2
response = urllib2.urlopen('http://api.xyz.com')
html = response.read()
</code></pre>

<p>IN <a href="http://api.xyz.com" rel="nofollow">http://api.xyz.com</a> </p>

<pre><code>{
  "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"
      }
    ]
}
</code></pre>

<p>Problem is: this url will return json output. and i want to read that json file but it is showing error: string indices must be integers, not str. </p>
