title: Multiple passes trough csv.reader in python
body: <p>trying to implement nested &quot;for&quot; loop in CSV files search in way  - 'name' found in one CSV file being searched in other file.  Here is code example:</p>
  <pre><code>    import csv
      import re
  
   
  # Open the input file 
  with open(&quot;Authentication.csv&quot;, &quot;r&quot;) as citiAuthen:
      with open(&quot;Authorization.csv&quot;, &quot;r&quot;) as citiAuthor:
      #Set up CSV reader and process the header
          csvAuthen = csv.reader(citiAuthen, quoting=csv.QUOTE_ALL, skipinitialspace=True)
          headerAuthen = next(csvAuthen)
          userIndex = headerAuthen.index(&quot;'USERNAME'&quot;)
          statusIndex = headerAuthen.index(&quot;'STATUS'&quot;)
  
          csvAuthor = csv.reader(citiAuthor)
          headerAuthor = next(csvAuthor)
          userAuthorIndex = headerAuthor.index(&quot;'USERNAME'&quot;)
          iseAuthorIndex = headerAuthor.index(&quot;'ISE_NODE'&quot;)
  
  
    
          # Make an empty list
          userList = []
          usrNumber = 0
          # Loop through the authen file and build a list of 
          for row in csvAuthen:
              user = row[userIndex]
              #status = row[statusIndex]
              #if status == &quot;'Pass'&quot; :
              for rowAuthor in csvAuthor:
                  userAuthor = rowAuthor[userAuthorIndex]
                  print userAuthor
  </code></pre>
  <p>What is happening that &quot;print userAuthor&quot;  make just one pass, while it has to make as many passes as there rows in csvAuthen.
  What I am doing wrong?  Any help is really appreciated.</p>