[Tutor] Hmmm...

Jörg Wölke lumbricus@gmx.net
Fri, 9 Mar 2001 04:56:48 +0100 (MET)


--========GMXBoundary605984110208
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

> 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?
> 
> Britt
> 
> --
> It is pitch black. You are likely to be eaten by a grue.
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
Something like that?
##########################

-- 
Sent through GMX FreeMail - http://www.gmx.net
--========GMXBoundary605984110208
Content-Type: application/octet-stream; name=""fil.py""; name="fil.py"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="fil.py"

IyEvdXNyL2Jpbi9lbnYgcHl0aG9uCnNvbWVWZWdnaWVzPVsna2Fyb3R0ZScsJ3J1ZWJlbicsJ25h
c2UnXQpkZWYgZihpdGVtKToKICAgIGlmIGl0ZW0gPT0gJ25hc2UnOgoJcmV0dXJuIHNvbWVWZWdn
aWVzLnBvcChzb21lVmVnZ2llcy5pbmRleChpdGVtKSkKCmRlZiBtYWluKCk6CiAgICBwcmludCBm
aWx0ZXIoZixzb21lVmVnZ2llcykKICAgIHByaW50IHNvbWVWZWdnaWVzCgppZiBfX25hbWVfXyA9
PSAnX19tYWluX18nOgogICAgbWFpbigpCg==
--========GMXBoundary605984110208--