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

Paul McGuire ptmcg at
Mon Apr 9 02:09:43 CEST 2007

On Apr 3, 3:47 pm, irs... at 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