Testing if string contains a substring

Klaus Alexander Seistrup spam at magnetic-ink.dk
Wed Apr 23 11:52:44 EDT 2003


Jp Calderone wrote:

>> >>> contains = lambda haystack, needle: haystack.find(needle) > 0
> 
>   The above should be >= 0, otherwise the first example below fails.

Of course.  Thanks for the correction.


  // Klaus

-- 
 ><> 	unselfish actions pay back better




More information about the Python-list mailing list