title: return index for rows in csv module python
body: <p>I'm trying to return a specific string that reads out "RowX: [sum of row]" for each row of a tsv table where X = the row number (index +1). So far I can get everything to work except for the row number. </p>
  
  <p>My code: </p>
  
  <pre><code>#!/usr/bin/env python
  
  from __future__ import division, print_function
  
  import sys
  import csv
  
  
  
  def my_sum(row):
      a = 0
      for i in row:
      a = a + float(i)
      return a
  
  def main():
      tsvfile_input = sys.argv[1]
      data = csv.reader(open(tsvfile_input), delimiter = '\t')
  
      for row in data:
          RowSum = my_sum(row)
          print('Row' + 'X' + ': ' + str(RowSum))
  
  
  
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>So far in place of 'X' I've tried data.index(), which returned:</p>
  
  <pre><code>AttributeError: '_csv.reader' object has no attribute 'index'
  </code></pre>
  
  <p>Sorry if obvious. I'm extremely new to coding and am doing this as part of an exercise. Also, if you're wondering why I didn't just use sum(), it's part of the exercise to not use sum().</p>
  
  <p>Thanks!</p>