i want to delete Tuples out of a list if they have the same number…
list1 = [(0, 2), (0, 3), (25, 25), (0, 9), (26, 26), (27, 27)]
and I need
list2 = [(0, 2), (0, 3), (0, 9)]
Thanks a lot!
Advertisement
Answer
Try this:
list2 = [item for item in list1 if item[0] != item[1]]