title: Python - loops with reading csv file
body: <p>I want to read <code>CSV</code> files and get similar words of first element in a row. If there is any, then compare others elements in this rows.</p>
  
  <p>F.e. test_items.csv: </p>
  
  <pre><code>name, value1, value2
  ball, 2.5, 2.3
  table, 112.5, 3.5
  pen, 8.1, 3.5, 4.7
  </code></pre>
  
  <p>pin_items.csv:</p>
  
  <pre><code>name, value1, value2
  balls, 2.5, 2.3
  table1, 112.5, 3.5
  pens12, 8.1, 3.5, 4.7
  </code></pre>
  
  <p>code:</p>
  
  <pre><code>with open('test_items.csv', 'r') as plik:
      tab = []
      for element in csv.reader(plik):
          tab.append(element)
  
  with open('pin_items.csv', 'r') as plik1:
       tab1=[]
       for element1 in csv.reader(plik1):
           tab1.append(element1)                        
  
  for row in tab:
      for row1 in test:
          z = get_close_matches(row[0], row1[0])
          print z
  </code></pre>
  
  <p>In this case a get outputs of empty "[]"</p>
  
  <p>But when I use this:</p>
  
  <pre><code>with open('test_items.csv', 'r') as plik:
      tab = []
      for element in csv.reader(plik):
          tab.append(element)
  
  with open('pin_items.csv', 'r') as plik1:
       tab1=[]
       for element1 in csv.reader(plik1):
           tab1.append(element1)                        
  
  for i in [row[0] for row in tab]:
      z = get_close_matches(i,[row1[0] for row1 in tab1])
      print z
  </code></pre>
  
  <p>then it matchs name's itmes correctly, but I'm not able to compare value of itmes of matched rows.</p>
  
  <p>Any suggestion? I'm using Python 2.7.11, thanks.</p>