python - Remove duplicates and finding unique sublists -


i have nested list looks this:

lst = [[1,2,3],[1,2],[1,2,3],[2,3],[4,5],[2,3],[2,4],[4,2]] 

i find unique sublists in lst. using above example, i'd find:

lst_set = [1,2,3],[1,2],[2,3],[4,5],[2,4]] 

order not matter. in otherwords, [2,4] , [4,2] same.

in [22]: lst = [[1,2,3],[1,2],[1,2,3],[2,3],[4,5],[2,3],[2,4],[4,2]]  in [23]: set(frozenset(item) item in lst) out[23]:  set([frozenset([2, 4]),      frozenset([1, 2]),      frozenset([2, 3]),      frozenset([1, 2, 3]),      frozenset([4, 5])]) 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -