I want to be able to remove an element from a list of list when a field in a list is duplicated in python3.
I.E:
Remove from the following list of lists when the second field is duplicated. From
[["John","France"], ["Mike", "France"], ["Ana","Italy"]]
To
[["John","France"], ["Ana","Italy"]]
Edit: I have tried the following loop, but I am looking forward to a more efficient way if it exists.
for element in consult_array:
for other_elements in consult_array:
if element[1] == other_elements[1]:
if element != other_elements:
consult_array.pop(element)