How to make a set of lists

You can create a set of tuples, a set of lists will not be possible because of non hashable elements as you mentioned.

>>> l = [[1, 2, 3], [2, 4, 5], [1, 2, 3], [2, 4, 5]]
>>> set(tuple(i) for i in l)
{(1, 2, 3), (2, 4, 5)}

Leave a Comment