[Tutor] Hmmm...

Sean 'Shaleh' Perry shaleh@valinux.com
Thu, 8 Mar 2001 23:53:40 -0800


On Thu, Mar 08, 2001 at 07:03:09PM -0800, Britt Green wrote:
> If I have a list, is there a way to extract from it the element that 
> contains a string?
> 
> For example, if I have:
> 
> someVeggies = ['carrot', 'lettuce', 'rhubarb', 'peas']
> 
> how would i extract the element that matches the string 'carrot' or 'peas' 
> and put that into another string?
>

if 'carrot' in someVeggies:
   print 'Veggies has a carrot'

is that useful?