index and find

Sam Pointon free.condiments at gmail.com
Sat Oct 22 23:16:19 EDT 2005


>>> s = 'foobar'
>>> s.find('z')
-1
>>> s.index('z')

Traceback (most recent call last):
  File "<pyshell#32>", line 1, in -toplevel-
    s.index('z')
ValueError: substring not found


Pretty self explanatory.




More information about the Python-list mailing list