What's the best way to delete duplicated entries in a list?
gradha at iname.com
gradha at iname.com
Sat Jul 21 09:54:23 EDT 2001
Hi.
Given a list of strings, I am doing the following to delete duplicated
entries:
my_list.sort()
x = 0
while x < len (my_list) - 1:
if my_list[x] == my_list[x+1]:
del my_list[x+1]
else:
x = x + 1
Is there some more elegant, fast, algorithm? Is this the only one
obvious way to do it?
--
Grzegorz Adam Hankiewicz gradha at terra.es http://gradha.infierno.org
More information about the Python-list
mailing list