[Tutor] membership

alan.gauld@bt.com alan.gauld@bt.com
Wed, 5 Dec 2001 12:08:27 -0000


>  this short piece of code works using the membership
> function. However adding what is below:
> 
> t1 = "a little red moon"
> t2 = t1
> t3 = "redmond washington"
> 
> if ("r" in t2):
>     print "t2"
>     print t2
>    
> if ("re" in t2):

The membership operator only works for single items.
You need the string functions for this: string.search()
in this case.

Alan G