[Tutor] [tutor] Difference between index and find in manipulating strings
Varsha Purohit
varsha.purohit at gmail.com
Mon Sep 3 00:21:17 CEST 2007
Hello,
i have again very basic question in python string management.
I am not able to understand how find and index works and what do they
actually return.
>>> line = "this is varsha"
>>> print line.find("is")
2
>>> print line.rfind("is")
5
>>> print line.rfind("varsha")
8
>>> print line.index("varsha")
8
what does 2 in first line signifies... and why rfind gave 5 as an output...
can anybody pls explain me what exactly is interpreter tryin to return.....
--
Varsha Purohit,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070902/9c8726bc/attachment.htm
More information about the Tutor
mailing list