On Sat, 22 Oct 2005, Shi Mu wrote: > 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.
index raises a ValueError if the string isn't found: >>> s = "spam" >>> s.find('m') 3 >>> s.index('m') 3 >>> s.find('z') -1 >>> s.index('z') Traceback (most recent call last): File "<stdin>", line 1, in ? ValueError: substring not found _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor