title: Row level string comparison in Python
body: <p>I am trying to compare two csv file at row level. If string is matched then print the correct string.</p>
  
  <pre><code>import csv
  file1 = open('/a1.csv','rb')
  file2 = open('/test.csv','rb')
  myfile = csv.reader(file1, delimiter=',')
  myfile1 = csv.reader(file2, delimiter=',')
      for row in myfile:
          for row1 in myfile1:
              new=""
              if row1[0] == row:
                  new = row[0]
              else:
                  new = row1[0]
              print new
  </code></pre>
  
  <p>a1.csv contain sample input as:</p>
  
  <pre><code>A,a,a1,a2
  B,b,b1,b5
  </code></pre>
  
  <p>test.csv contain sample input as: </p>
  
  <pre><code>a
  a!    
  </code></pre>
  
  <p>If string is matched, for example "a" == "A,a,a1,a2" then I want to print 'A' and In case there is no match, for example "a!" == "A,a,a1,a2" then need to print 'a!'  </p>
  
  <p>My code is printing "a" and "a!" output without comparison. Is this the incorrect way to compare a string? </p>