in a nested list like the one below, I'd like to remove duplicates depending on the position.
[[1,2,3,4], [2,1,3,4], [1,2,3,4], [1,3,2,4]]
So every sub-list contains the same numbers, but in different order. If the order of the numbers is the same, I would like to delete this duplicate. So the list above should look like:
[[1,2,3,4], [2,1,3,4], [1,3,2,4]]
I have tried to write some code by myself, but since I am a beginner, there is no working result. I have tried:
result = []
for i in test_list:
if i not in result:
result.append(i)
return result
Or
tpls = [tuple(x) for x in test_list]
dct = list(dict.fromkeys(tpls))
dup_free = [list(x) for x in test_list]
return dup_free
Thanks!
EDIT2: Sorry everbody, the input was wrong so the code just could not work...
test_listinstead ofdct.returnstatement is here.