I've a list that contains thousands of Instagram usernames and some of them are repeated 2 or 3 times. I want to remove all the duplicates in one function but when I try to remove all the duplicates some of them remains in the list and are removed when I call that function again and again.
>>> def rem():
for n in m:
if m.count(n) > 1:
m.remove(n)
print(len(m))
>>> rem()
231
>>> rem()
200
>>> rem()
200
Here is the sample List:
>>> a = list(range(100))
>>> b = list(range(150))
>>> c = list(range(40, 100))
>>> d = list(range(100, 200))
>>> m = a+b+c+d