title: Comparing a list of strings to a list of strings (python)
body: <p>I'm trying to compare two excel documents to each other, they are made up of around 6000 rows and 4 columns, the first column is a domain name, the other three are comments, one of the documents has updated comments in some of the columns and eventually I would like this script to function like a batch update of new comments replacing the old outdated ones.</p>
  
  <p>The code I have written so far opens the documents and adds them to two separate lists:</p>
  
  <pre><code>import csv
  
  newlist = csv.reader(open('newcomments.csv','rU'), dialect='excel')
  export = csv.reader(open('oldcomments.csv', 'rU'), dialect='excel')
  
  for row in newlist:
      olddomain=[]
      domain = row[0:]
      olddomain.append(domain)
      for item in olddomain:
          print item
  
      for row in export:
          newdomain=[]
          domain= row[0:]
          newdomain.append(domain)
          for item in newdomain:
              print item
  </code></pre>
  
  <p>the output from the lists looks like(the second column is normally blank):</p>
  
  <pre><code>['example.com', '', 'excomment', 'Parked Page']
  </code></pre>
  
  <p>When trying to compare the lists i have tried something like:</p>
  
  <pre><code>if item in olddomain != item in newdomain:
                      print "no match"
                  else:
                      print "match"
  </code></pre>
  
  <p>but that doesn't appear to work,for example, the first row in the two files contain the exact same data, but the code returns "no match", the second row in both files also contains the same data, but the code returns "match" </p>
  
  <p>Is the problem with the way I am saving the rows to the list, or is there something else I'm missing? I'm going to assume there is a better way of doing this but I'm using it as an excuse to learn more python!</p>
  
  <p>Thanks for your time.</p>