iterating through lists to delete elements

Rich Harkins rharkins at thinkronize.com
Thu Aug 9 18:17:18 CEST 2001


Whoops!  This should be

list=[x for x in list if x <= y]

Too much SQL writing lately has melted by brain! ;)

Rich


> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Rich Harkins
> Sent: Thursday, August 09, 2001 12:09 PM
> To: Python-List
> Subject: RE: iterating through lists to delete elements
> 
> 
> How about (in Python 2.x-ish):
> 
> list=[x for x in list where x <= y]  # assuming you want to keep 
> everything
> <= y.
> 
> Rich
> 
> 
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 




More information about the Python-list mailing list