title: How to compare columns from two csv files?
body: <p>I am trying to compare columns from 2 csv files.</p>
  
  <p>In file1.csv:</p>
  
  <pre><code>aaa,1
  abc,2
  bcd,2
  adc,3
  </code></pre>
  
  <p>In file2.csv:</p>
  
  <pre><code>aaa,1
  abc,0
  bcd,2
  adc,4
  </code></pre>
  
  <p><strong>I expected to get the results "Not Equ".</strong></p>
  
  <p><strong>If the first columns are the same but the second columns are difference.</strong></p>
  
  <p>I tried the codes below but not success:</p>
  
  <pre><code>import csv
  file1 = 'C:/Users/Desktop/file1.csv'
  file2 = 'C:/Users/Desktop/file2.csv'
  
  reader1 = csv.reader(open(file1))
  reader2 = csv.reader(open(file2))
  
  for row1 in reader1:
      text1 = row1[0].split(',')
      test1sentence = text1[0]
      test1class = text1[1]
  
      for row2 in reader2:
          text2 = row2[0].split(',')
          test2sentence = text2[0]
          test2class = text2[1]
  
          if test1sentence == test2sentence:
              if test1class != test2class:
                  print "Not Equ"
  </code></pre>
  
  <p>Any suggestion?</p>