Efficiently finding duplicates in a list

Published: 5/10/2017
Efficiently finding duplicates in a list
Source: STACKOVERFLOW.COM

I have the function below which searches an array for duplicate entries and then returns a list of the duplicates. I'd like to speed this piece of my code up, can anyone suggest a more efficient way? Code: def findDupe(array): dupelist = [] for i in range(len(array)): for j in range(len(array)): comp1 = array[i] comp2 = array[j] if comp1 == comp2 and i!=j: if comp2 not in dupelist: dupelist.appen

Read more
Related news
Comment