[BangPypers] How for and list.remove() works
Kiran Jonnalagadda
jace at pobox.com
Thu Jul 10 10:47:01 CEST 2008
That's rather clever, Anand. My hackish solution to this sort of thing
has usually been:
while 12 in a:
a.remove(12)
Which I've normally used when removing blank strings from a recently
split string.
--
Kiran Jonnalagadda
http://jace.seacrow.com/
http://jace.livejournal.com/
On 10-Jul-08, at 2:03 PM, Anand Balachandran Pillai wrote:
> Here is what is arguably the solution with the least code.
>
>>>> a = [12, 12, 1321, 34, 23, 12, 34, 45, 77]
>>>> list(set(a)-set([12]))
> [1321, 34, 23, 45, 77]
>
>
> Cheers
>
> --Anand
More information about the BangPypers
mailing list