On Apr 4, 2:20 am, "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. > > It seems like regular expressions is the rescue, but I couldn't find > the right tool. > > Thanks! > bahoo
how about this: >>> target = "0024" >>> l = ["0024", "haha", "0024", "0024", "sfs"] >>> result = [ item for item in l if item != target] >>> result ['haha', 'sfs'] -- http://mail.python.org/mailman/listinfo/python-list