A solution to remove the duplicates?
<p>My code is below. Basically, I've got a CSV file and a text file "input.txt". I'm trying to create a Python application which will take the input from "input.txt" and search through the CSV file for a match and if a match is found, then it should return the first column of the CSV file.</p>

<pre><code>import csv
csv_file = csv.reader(open('some_csv_file.csv', 'r'), delimiter = ",")
header = csv_file.next()
data = list(csv_file)

input_file = open("input.txt", "r")
lines = input_file.readlines()
for row in lines:
    inputs = row.strip().split(" ")
    for input in inputs:
        input = input.lower()
        for row in data:
            if any(input in terms.lower() for terms in row):
                print row[0]
</code></pre>

<p>Say my CSV file looks like this:</p>

<pre><code> book title, author 
 The Rock, Herry Putter
 Business Economics, Herry Putter    
 Yogurt, Daniel Putter
 Short Story, Rick Pan
</code></pre>

<p>And say my input.txt looks like this:</p>

<pre><code> Herry
 Putter
</code></pre>

<p>Therefore when I run my program, it prints:</p>

<pre><code> The Rock
 Business Economics
 The Rock
 Business Economics
 Yogurt
</code></pre>

<p>This is because it searches for all titles with "Herry" first, and then searches all over again for "Putter". So in the end, I have duplicates of the book titles. I'm trying to figure out a way to remove them...so if anyone can help, that would be greatly appreciated.</p>
