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

Staff online

Members online

Forum statistics

Threads
474,269
Messages
2,571,349
Members
48,028
Latest member
Rigor4

Latest Threads

Top