title: Python Failed with KeyError
body: <pre><code>def getQuotesYahoo():
  
      tickerStr = &quot;GOOGL+AMZN&quot;
      yahoo_url =&quot;http://finance.yahoo.com/d/quotes.csv?s=%s&amp;f=saohgb3t1&quot; % (tickerStr)
      retQuotes = {}
  
      data = urllib2.urlopen(yahoo_url).readlines()
  
      for d in data:
          p = d.strip().split(',')
          stkInfo = {}
          stkInfo['lastTime'] = p[6]
          stkInfo['last'] = p[1]
          stkInfo['open'] = p[2]
          stkInfo['high'] = p[3]
          stkInfo['low'] = p[4]
          stkInfo['bid'] = p[5]
          tic = p[0]
          print stkInfo
          retQuotes[tic] = stkInfo
  
      print retQuotes['GOOGL']['last']
  </code></pre>
  <p>This code fails on KeyError and not populating dictionary with string key.  I have basically same code working for googlefiance.</p>
  <blockquote>
  <p>KeyError: 'GOOGL'</p>
  <p>retQuotes:</p>
  <p>{'&quot;AMZN&quot;': {'last': '594.60', 'bid': 'N/A', 'high': '597.86', 'low': '589.00', 'lastTime': '&quot;4:00pm&quot;', 'open': '594.32'}, '&quot;GOOGL&quot;': {'last': '759.98', 'bid': 'N/A', 'high': '767.13', 'low': '755.77', 'lastTime': '&quot;4:00pm&quot;', 'open': '765.87'}}</p>
  </blockquote>