On 3 Apr 2007 11:20:33 -0700, bahoo <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a list like ['0024', 'haha', '0024']
> and as output I want ['haha']
>
> If I
> myList.remove('0024')
>
> then only the first instance of '0024' is removed.

To remove all items with multiple occurances in myList:

list(set(myList) - set([x for x in myList if myList.count(x)>1]))

cheers,
-- 
----
Amit Khemka -- onyomo.com
Home Page: www.cse.iitd.ernet.in/~csd00377
Endless the world's turn, endless the sun's Spinning, Endless the quest;
I turn again, back to my own beginning, And here, find rest.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to