Still unsure about the approach ndc85430, but thinking about something like this.
mylist = [ [1, "a"], [2, "b"], [1, "c"], [1, "c"], [1, "c"], [1, "a"] ] test = [a[1] for a in mylist] # ['a', 'b', 'c', 'c', '33', 'a'] from collections import Counter collection_counter = Counter(test) for m in mylist: print "element {} num of times: {}".format(m[0], collection_counter.get(m[1])) num_occurance = 0 newlist = "" for key in collection_counter: if collection_counter[key] == 1: num_occurance = num_occurance + 1 newlist = key print num_occurance if num_occurance == 1: print "unique value found: {}".format(newlist) print [x for x in mylist if x[1] == newlist] else: print "bummer, no uniques found"
mylist = [ [1, "a"], [2, "b"], [1, "c"], [1, "c"], [1, "c"], [1, "a"] ] #[[2, 'b']] #(annoying nested list ..grrr) mylist = [ [1, "a"], [2, "b"], [1, "c"], [1, "c"], [1, "33"], [1, "a"] ] # bummer, no uniques found #(annoying nested list ..grrr)