title: Python extract unique values from CSV
body: <p>I am using the following python script to remove duplicates from a CSV file</p>
  
  <pre><code>with open('test.csv','r') as in_file, open('final.csv','w') as out_file:
      seen = set() # set for fast O(1) amortized lookup
      for line in in_file:
          if line in seen: continue # skip duplicate
  
          seen.add(line)
          out_file.write(line)
  </code></pre>
  
  <p>I am trying to modify it so that instead of outputting the list without duplicates to final.csv it outputs the unique values that were found.</p>
  
  <p>Kind of the opposite to what it does now.  Anyone got an example?</p>