found_vals = {}
with open(inputfile, 'r') as in_file:
    for line in in_file:
        line = line.split()
if line[0] in vals_set:
    found_vals[line[0]] = line[1]
not_found_vals = vals_set.difference(found_vals)
Fastest way to grep multiple values from file in python