Re: [Tutor] Comparing two lists

2010-09-16 Thread Steven D'Aprano
On Fri, 17 Sep 2010 04:27:28 am Michael Powe wrote: > Hello, > > I have two lists. > > alist = ['label', 'guid'] > > blist = ['column0label', 'column1label', 'dimension0guid', > 'description', 'columnid'] > > I want to iterate over blist and extract the items that match my > substrings in alist;

Re: [Tutor] Comparing two lists

2010-09-16 Thread Michael Powe
On Thu, Sep 16, 2010 at 12:59:08PM -0600, Vince Spicer wrote: > On Thu, Sep 16, 2010 at 12:49 PM, Vince Spicer wrote: > > On Thu, Sep 16, 2010 at 12:27 PM, Michael Powe wrote: > >> I have two lists. > >> alist = ['label', 'guid'] > >> > >> blist = ['column0label', 'column1label', 'dimension0gui

Re: [Tutor] Comparing two lists

2010-09-16 Thread Emile van Sebille
On 9/16/2010 11:27 AM Michael Powe said... Hello, I have two lists. alist = ['label', 'guid'] blist = ['column0label', 'column1label', 'dimension0guid', 'description', 'columnid'] Something like this? >>> [ ii for jj in alist for ii in blist if jj in ii ] ['column0label', 'column1label', '

Re: [Tutor] Comparing two lists

2010-09-16 Thread Michael Powe
On Thu, Sep 16, 2010 at 12:59:08PM -0600, Vince Spicer wrote: > On Thu, Sep 16, 2010 at 12:49 PM, Vince Spicer wrote: > > On Thu, Sep 16, 2010 at 12:27 PM, Michael Powe wrote: > >> alist = ['label', 'guid'] > >> blist = ['column0label', 'column1label', 'dimension0guid', > >> 'description', 'col

Re: [Tutor] Comparing two lists

2010-09-16 Thread Vince Spicer
On Thu, Sep 16, 2010 at 12:49 PM, Vince Spicer wrote: > > > On Thu, Sep 16, 2010 at 12:27 PM, Michael Powe wrote: > >> Hello, >> >> I have two lists. >> >> alist = ['label', 'guid'] >> >> blist = ['column0label', 'column1label', 'dimension0guid', >> 'description', 'columnid'] >> >> I want to iter

Re: [Tutor] Comparing two lists

2010-09-16 Thread Vince Spicer
On Thu, Sep 16, 2010 at 12:27 PM, Michael Powe wrote: > Hello, > > I have two lists. > > alist = ['label', 'guid'] > > blist = ['column0label', 'column1label', 'dimension0guid', > 'description', 'columnid'] > > I want to iterate over blist and extract the items that match my > substrings in alist

[Tutor] Comparing two lists

2010-09-16 Thread Michael Powe
Hello, I have two lists. alist = ['label', 'guid'] blist = ['column0label', 'column1label', 'dimension0guid', 'description', 'columnid'] I want to iterate over blist and extract the items that match my substrings in alist; alternatively, throw out the items that aren't in alist (but, I've had