how to remove multiple occurrences of a string within a list?
Paul McGuire
ptmcg at austin.rr.com
Sun Apr 8 20:09:43 EDT 2007
On Apr 3, 3:47 pm, irs... at gmail.com wrote:
> Beware that converting a list to set and then back to list won't
> preserve the order of the items, because the set-type loses the order.
Also beware that this conversion will remove duplicates, so that if
'haha' is in the original list multiple times, there will only be one
after converting to a set and then back to a list. Only you can tell
us whether this behavior is desirable or not.
-- Paul
More information about the Python-list
mailing list