Python: Check one element in csv, use another to remove from second file
===

I am trying to get a script working, where it will check the existance of an IP in a lookup csv file, and then if it exists take the third element and remove that third element from another (second) file. Here is a extract of what I have:

    for line in fileinput.input(hostsURLFileLoc,inplace =1):
            elements = open(hostsLookFileLoc, 'r').read().split(".").split("\n")
            first = elements[0].strip()
            third = elements[2].strip()
            if first == hostIP:
                    if line != third:
                            print line.strip()

This obviously doesn't work, I have tried playing with a few options, but here is my latest (crazy) attempt.

Any thoughts welcome,

Cheers,

MHibbin