I am trying to find duplicates inside an array. my array looks like:
['LM_Auto', 'LM_Auto', 'LM_Op', 'LM_Op']
and much longer with a few thousand of these pairs.
def clear_stemmed_LM(collection):
i = 0
ele = i+1
for i in collection:
for ele in collection:
if i == ele:
del collection[ele]
return collection
the error says the list indices must be integers or slices not strings. How can I compare strings in an array?
[if x+1 for in x range] #Idea
or something similar like this?