a = ['1', '2'] b = ['1', '2', '3', '4'] diff = list(set(a) - set(b)) ['3', '4']
s = set(temp2) temp3 = [x for x in temp1 if x not in s]