Removing items from a list in a loop
Christian Tanzer
tanzer at swing.co.at
Wed Jun 21 11:55:42 EDT 2000
More information about the Python-list mailing list
Wed Jun 21 11:55:42 EDT 2000
- Previous message (by thread): Removing items from a list in a loop
- Next message (by thread): Removing items from a list in a loop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
olczyk at interaccess.com (Thaddeus L. Olczyk) wrote: > I would like to remove a bunch of items from a list *efficiently*. > Essentially I would like to do this: > > for x in list: > if Function(x): > list.remove(x) > > This does not work. list = filter (lambda x : not Function (x), list) -- Christian Tanzer tanzer at swing.co.at Glasauergasse 32 Tel: +43 1 876 62 36 A-1130 Vienna, Austria Fax: +43 1 877 66 92
- Previous message (by thread): Removing items from a list in a loop
- Next message (by thread): Removing items from a list in a loop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list