Most efficient solution?

Bernhard Herzog bh at intevation.de
Mon Jul 16 11:39:47 EDT 2001


Alex <new_name at mit.edu> writes:

> > C = {}
> > for item in B:
> >     C[item] = 1
> > 
> > A = filter(C.get, A)
> 
> I guess that'll drop some elements from A that are in B but evaluate to
> false, though.

I just realized that it does exactly the opposite of what the OP wanted.
It keeps all occurences of words in B instead of removing them. :(

  Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
MapIt!                                               http://mapit.de/



More information about the Python-list mailing list