RE Module Question.

Paul Winkler slinkp23 at
Tue Nov 6 18:15:07 CET 2001

On Tue, 06 Nov 2001 15:25:11 GMT, Grant Edwards <grante at> wrote:
>In article <mailman.1005039367.28367.python-list at>, Corrado Gioannini wrote:
>> On Tue, Nov 06, 2001 at 05:49:38AM +0000, Paul Winkler wrote:
>> [snip] 
>>> You can do it like so:
>>> test = "this is spam"
>>> if test.find("spam"): print "found it"
>> this would fail if the sub-string to be found is at the beginning of the
>> string (find returning 0).
>It also fails if the string is not present, since find()
>returns a -1 in that case.  

Very sorry for the incorrect advice. Should've checked before posting...


More information about the Python-list mailing list