i have list of lists.
list = [[1, 2, '0.68', 1.24], [1, 2, '0.43', 2.39], [3, 0, '0.91', 3.61], [0, 3, '0.08', 3.95], [3, 0, '0.08', 5.17]
What I want to do is delete the tist who has the same first and second element.
1.Example :
[1, 2, '0.68', 1.24]
and [1, 2, '0.43', 2.39]
. I want to delete one of them.
- Example:
[3, 0, '0.91', 3.61]
and[0, 3, '0.08', 3.95]
and here is the same thing. One of them should be deleted.
My Code:
def delete_Duplicate(liste):
for li in liste:
for li2 in liste:
if (li[0] == li2[0] and li[1] == li2[1] ) or (li[1] == li2[0] and li[0] == li2[1] ):
liste.pop(liste.index(li2))
return liste
The result should be like this:
output: [[1, 2, '0.68', 1.24], [3, 0, '0.91', 3.61]]