I have two lists of nested lists, and I want to find the intersection of these two lists. I have tried using the set()
function and the intersection()
method, but they do not seem to work for nested lists. Can anyone suggest a way to do this?
Here is an example of the two nested lists:
list1 = [[1, 2], [3, 4], [5, 6]]
list2 = [[3, 4], [5, 6], [7, 8]]
I want to find the intersection of these two lists, which in this case would be:
[[3, 4], [5, 6]]
Any help would be greatly appreciated. Thanks!