![]() |
|
|
+ Search |
![]()
|
Mar 1st, 2000 19:24
Nathan Wallace, Fredrik Lundh
if string.find(mystring, "foo") >= 0:
...
or
string.index(mystring, "foo")
...
The latter raises a ValueError exception if the substring isn't found.
For more info, see the "string" chapter in the library reference:
http://www.python.org/doc/current/lib/module-string.html