title: Comparing two CSV Files Based on Specific Data in two Columns
body: <p>I was encouraged to step out of my comfort zone and use python with little to no experience and now I'm stuck.  I'm trying to compare two CSV files (fileA.csv and fileB.csv), and append any missing user rows to fileA.csv from fileB.csv.  The only fields I can compare with are user's first and last names (in this case, it's row[0] and row[2] from each file).</p>
  
  <p>From my understanding, you cannot append information to a file that you currently have open so I'm open to suggestions without having to create a third file (if possible).  Below has me on the right track, but there's a lot of data so I'll need a loop.  Please help.</p>
  
  <pre><code>import csv
  reader1 = csv.reader(open('fileA', 'rb'), delimiter=',', quotechar='|')
  row1 = reader1.next()
  reader2 = csv.reader(open('fileB', 'rb'), delimiter=',', quotechar='|')
  row2 = reader2.next()
  
  
  ##For Loop...
  
          if (row1[0] == row2[0]) and (row1[2] == row2[2]):
                  ## Compare next 
          else:
                  ## Append entire row to fileA.csv
  </code></pre>
  
  <hr>
  
  <p>Example FileA.csv:</p>
  
  <pre><code>John,Thomas,Doe,some,other,stuff
  Jane, ,Smith,some,other,stuff
  </code></pre>
  
  <p>Example FileB.csv:</p>
  
  <pre><code>John, ,Doe,other,personal,data
  Jane,Elizabeth,Smith,other,personal,data
  Robin,T,Williams,other,personal,data
  </code></pre>
  
  <p>The only row that should append from FileB to FileA is Robin's complete Row so that FileA looks like:</p>
  
  <p>DesiredResult_FileA:</p>
  
  <pre><code>John,Thomas,Doe,some,other,stuff
  Jane, ,Smith,some,other,stuff
  Robin,T,Williams,other,personal,data
  </code></pre>