title: Python CSV reader return Row as list
body: <p>Im trying to parse a CSV using python and would like to be able to index items in a row so they can be accessed using <code>row[0]</code>, <code>row[1]</code> and so on.</p>
  
  <p>So far this is my code:</p>
  
  <pre><code>def get_bitstats():
      url = 'http://bitcoincharts.com/t/trades.csv?symbol=mtgoxUSD'
      data = urllib.urlopen(url).read()
      dictReader = csv.DictReader(data)
      obj = BitData()
      for row in dictReader:
  
          obj.datetime = datetime.datetime.fromtimestamp(int(row['0'])/1000000)
          q = db.Query(BitData).filter('datetime', obj.datetime)
          if q != None:
              raise ValueError(obj.datetime + 'is already in database')
          else:
              obj.price = row['1']
              obj.amount = row['2']
              obj.put()
  </code></pre>
  
  <p>This returns <code>KeyError: '0'</code> and I have no idea how to set it up. I did input this into an interactive shell and when running</p>
  
  <pre><code>for row in dictReader:
      print row
  </code></pre>
  
  <p>I get this as the output:</p>
  
  <pre><code>{'1': '3'}
  {'1': '6'}
  {'1': '2'}
  {'1': '6'}
  {'1': '9'}
  {'1': '8'}
  {'1': '6'}
  {'1': '4'}
  {'1': '4'}
  {'1': '', None: ['']}
  {'1': '4'}
  {'1': '2'}
  {'1': '.'}
  {'1': '0'}
  {'1': '5'}
  {'1': '7'}
  {'1': '1'}
  {'1': '6'}
  {'1': '0'}
  {'1': '0'}
  {'1': '0'}
  {'1': '0'}
  {'1': '0'}
  {'1': '0'}
  {'1': '0'}
  {'1': '', None: ['']}
  {'1': '0'}
  {'1': '.'}
  {'1': '0'}
  {'1': '1'}
  {'1': '0'}
  {'1': '0'}
  {'1': '5'}
  {'1': '4'}
  {'1': '2'}
  {'1': '5'}
  {'1': '0'}
  {'1': '0'}
  {'1': '0'}
  {'1': '0'}
  {'1': '1'}
  {'1': '3'}
  {'1': '6'}
  {'1': '2'}
  {'1': '6'}
  {'1': '9'}
  {'1': '8'}
  {'1': '6'}
  {'1': '4'}
  {'1': '4'}
  </code></pre>
  
  <p>and on and on for thousands and thousands of lines. ( as Im sure the CSV is thousands of digits)</p>
  
  <p>Why is my CSV printing this way and is there anyway to separate a row into a list of 3 <code>ints</code> such as [130534543, 47.00009, 23001.9000]</p>
  
  <p>EDIT:</p>
  
  <p>as the Answer states I was using the wrong csv function in my code above but even though fixing it gave me a list the list itself was in the same format as the dict such that:</p>
  
  <pre><code>['1']
  ['2']
  ['1']
  ['3']
  ['8']
  ['3']
  ['5']
  .
  .
  .
  </code></pre>
  
  <p>It turns out I also had to remove the <code>.read()</code> from <code>data = urllib.urlopen(url).read()</code>.</p>