Python: Remove Duplicate Items from Nested list

duplicates, list, python

Solution

If the Order Matters you can always use OrderedDict

>>> unq_lst = OrderedDict()
>>> for e in lst:
    unq_lst.setdefault(frozenset(e),[]).append(e)


>>> map(list, unq_lst.keys())
[[1, 2], [4, 5], [3, 4]]

Problem

``` mylist = [[1,2],[4,5],[3,4],[4,3],[2,1],[1,2]] ``` I want to remove duplicate items, duplicated items can be reversed. The result should be : ``` mylist = [[1,2],[4,5],[3,4]] ``` How do I achieve this in Python?

Original source