Most efficient solution?

Jeffery D. Collins jcollins at boulder.net
Mon Jul 16 10:04:11 EDT 2001


On Mon, Jul 16, 2001 at 09:19:09AM -0400, Jay Parlar wrote:
<snip>

> List B consists of my "stopwords", meaning, the words I don't want included in my final version of list A. So what I need to 
> do is check every item in list A, and if it occurs in list B, then I want to remove it from the final version of A. My first thought 
> would be:
> 
> for eachItem in A:
>     if eachItem in B:
>         A.remove(eachItem)
> 

How about: 

map(A.remove, B)

-- 
Jeffery Collins (http://www.boulder.net/~jcollins)




More information about the Python-list mailing list