RE Module Question.
Paul Winkler
slinkp23 at yahoo.com
Tue Nov 6 12:15:07 EST 2001
More information about the Python-list mailing list
Tue Nov 6 12:15:07 EST 2001
- Previous message (by thread): RE Module Question.
- Next message (by thread): Python VM on Lego Mindstorms
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 06 Nov 2001 15:25:11 GMT, Grant Edwards <grante at visi.com> wrote: >In article <mailman.1005039367.28367.python-list at python.org>, 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. Whoops. Very sorry for the incorrect advice. Should've checked before posting... --PW
- Previous message (by thread): RE Module Question.
- Next message (by thread): Python VM on Lego Mindstorms
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list