'Advanced' list comprehension? query

BartlebyScrivener bscrivener42 at gmail.com
Wed Aug 8 18:14:48 CEST 2007


On Aug 8, 11:00 am, pyscottish... at hotmail.com wrote:
> Hi,
>
> I'm playing around with list comprehension, and I'm trying to find the
> most aesthetic way to do the following:
>
> I have two lists:
>
> noShowList = ['one', 'two', 'three']
>
> myList = ['item one', 'item four', 'three item']
>
> I want to show all the items from 'myList' that do not contain any of
> the strings in 'noShowList'.

I'm still learning these myself, but I think what you want is
itertools:

http://docs.python.org/lib/module-itertools.html





More information about the Python-list mailing list