I have two lists with tuples as shown below
a=[("a","b","c"),("d","e","f"),("h","e","d")]
b=[("b","c","a"),("d","e","f")]
I want to get the difference between two lists efficiently considering that the order of the elements in the tuple do not matter. So set(a) - set(b)
does not work, which gives me [('a', 'b', 'c'), ('h', 'e', 'd')]
as output.
Instead, I want the output given below. It should detect tuples as the same if the elements are just shuffled, such as (a, b, c)
and (b, a, c)
.
[('h', 'e', 'd')]