title: Python CSV search
body: <p>I am fairly new to python and have run into an issue which I believe to be strange. I am searching through the first column of a csvfile. </p>
  
  <p>I am using the csv module and have some code with nested for loops.  My intentions were for the loop in the middle to restart from the first row in the csvfile every time it finds a match.  But instead it always starts from the last row being searched in the csv.  </p>
  
  <p>My code below and the results will make my problem more apparent.</p>
  
  <pre><code>number = [1,3,5,6,7,8,1234,324,5,2,35]
  
  import csv
  
  with open('...../Documents/pycharm/testcsv.csv', 'rb') as csvimport:
      csvfile = csv.reader(csvimport)
  
      for num in number:
          print 'looking for ' + str(num)
          is_in_file = False
          print 'set to false'
          for row in csvfile:
              print 'looking at value ' + row[0]
              if row[0] == str(num):
                  is_in_file = True
                  print 'match, set to true'
                  break
          print 'test1'
          if is_in_file == False:
              print str(num) + ' not found in file!'
  </code></pre>
  
  <p>Here is what gets printed in the IDE:</p>
  
  <pre><code>looking for 1
  set to false
  looking at value a
  looking at value 1
  match, set to true
  test1
  looking for 3
  set to false
  </code></pre>
  
  <p>NOTE: here I wish to look at the first line of the csvfile (value a).  Instead it looks at the third line of the csvfile (value '').</p>
  
  <pre><code>looking at value 
  looking at value 1234
  looking at value 7
  looking at value 1
  looking at value 3
  match, set to true
  test1
  </code></pre>
  
  <p>From here on out it skips my inner for loop all together as it has gone through the last row:</p>
  
  <pre><code>looking for 5
  set to false
  looking at value 5
  match, set to true
  test1
  looking for 6
  set to false
  looking at value 6
  match, set to true
  test1
  looking for 7
  set to false
  looking at value 77
  looking at value 23
  looking at value 87
  test1
  7 not found in file!
  looking for 8
  set to false
  test1
  8 not found in file!
  looking for 1234
  set to false
  test1
  1234 not found in file!
  looking for 324
  set to false
  test1
  324 not found in file!
  looking for 5
  set to false
  test1
  5 not found in file!
  looking for 2
  set to false
  test1
  2 not found in file!
  looking for 35
  set to false
  test1
  35 not found in file!
  </code></pre>
  
  <p>Here is the csvfile</p>
  
  <pre><code>a,c,b,d,e
  1,3,4,5,6
  ,7,7,,87
  1234,1,98,7,76
  7,8,90,0,8
  1,3,98,0,0
  3,cat,food,20,39
  5,%,3,6,90
  6,2,2,2,3
  77,3,4,3,5
  23,3,4,3,6
  87,5,5,5,
  </code></pre>