title: string indices must be integers while parsing JSON - python
body: <p>I am new to python and facing this error: <code>string indices must be integers</code> while parsing a JSON file.</p>
  
  <p>JSON File: </p>
  
  <pre><code>{"NFLTeams": [
    {"code":"ARI","fullName":"Arizona Cardinals","shortName":"Arizona"},
    {"code":"ATL","fullName":"Atlanta Falcons","shortName":"Atlanta"},
    {"code":"WAS","fullName":"Washington Redskins","shortName":"Washington"}
  ]}
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>import urllib.request as ur
  import urllib.parse
  import json
  
  url = 'http://www.fantasyfootballnerd.com/service/nfl-teams/json/test/'
  user_agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'
  values = {'name' : 'Michael Foord',
            'location' : 'Northampton',
            'language' : 'Python' }
  headers = { 'User-Agent' : user_agent }
  
  data = urllib.parse.urlencode(values)
  data = data.encode('ascii')
  req = urllib.request.Request(url, data, headers)
  response = urllib.request.urlopen(req)
  the_page = response.read().decode('utf-8')
  
  print (the_page)
  team_data = json.loads(the_page)
  
  print (type(team_data))  // team_data is type dict
  
  for item in team_data:
      print (item['NFLTeams'][0]["code"])
      print (item['NFLTeams'][0]['fullName'])
      print (item['NFLTeams'][0]['shortName'])
  </code></pre>
  
  <p>I have tried to print the following:</p>
  
  <pre><code>print (item['NFLTeams']["code"]) 
  </code></pre>
  
  <p>And this:</p>
  
  <pre><code>for item in team_data['NFLTeams'].values():
      print (item["code"])
      print (item['fullName'])
      print (item['shortName'])
  </code></pre>
  
  <p>Which gives me this error:</p>
  
  <pre><code>for item in team_data['NFLTeams'].values():
  AttributeError: 'list' object has no attribute 'values'
  </code></pre>
  
  <p>Can anyone please help me figure out what's going on? Thank you.</p>