I am trying to remove duplicates from a nested list only if the first 2 elements are the same, ignoring the third ...
List:
L = [['el1','el2','value1'], ['el3','el4','value2'], ['el1','el2','value2'], ['el1','el5','value3']]
Will return:
L = [['el3','el4','value2'], ['el1','el2','value2'], ['el1','el5','value3']]
I found a simple way to do the same here :
dict((x[0], x) for x in L).values()
but this only works for the first element, not for the first 2, but this is exactly what I want otherwise.
source share