Testing if string contains a substring

Klaus Alexander Seistrup spam at magnetic-ink.dk
Wed Apr 23 17:52:44 CEST 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