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.append(comp2)
return dupelist