index and find

S

Shi Mu

what is the difference between index and find in the module of string?
for both "find" and "index", I got the position of the letter.
 
S

Sam Pointon

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


Pretty self explanatory.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top