how to remove multiple occurrences of a string within a list?

Matimus mccredie at gmail.com
Tue Apr 3 14:31:38 EDT 2007


It depends on your application, but a 'set' might really be what you
want, as opposed to a list.

>>> s = set(["0024","haha","0024"])
>>> s
set(["0024","haha"])
>>> s.remove("0024")
>>> s
set(["haha"])





More information about the Python-list mailing list