Id like to figure out a way to find all the similar elements from 2 different lists
The two list are as fallows,
A=[[[a1, b1],
[a2, b2],
[a3, b3]],
[[a1, b2],
[a2, b1],
[a3, b3]],
[[a1, b1],
[a3, b2],
[a2, b3]]]
B=[[[a1, b1],
[a3, b3],
[a2, b2]],
[[a1, b2],
[a2, b1],
[a3, b3]],
[[a1, b1],
[a3, b2],
[a2, b3]]]
Id consider the first elements of each list to be duplicates
[[a1, b1],[a2, b2], [a3, b3]] and
[[a1, b1],[a3, b3], [a2, b2]] to be duplicates.
The output Im looking for would be a list of either one of the common elements in a separate list as such,
C=[[a1, b1],[a2, b2], [a3, b3]]
Ive been working with this code, but it doesn't recognize they first two elements as duplicate and I'm wondering what I should add to account for it.
C=[ i for i in A if i in B]