Python .find() string method -


i wondering if .find() string method in python. here example:

    word = 'banana'     index = word.find('a')     1#result     word.find('na')      2#result     word.find('na', 3)     4#result      name = 'bob'      name.find('b', 1, 2)      -1#result 

could explain string method does? part word.find('na') , word.find('b',1,2), numbers , meaning of results happen when running these commands?? thank helping out!

in [1]: print str.find.__doc__ s.find(sub [,start [,end]]) -> int  return lowest index in s substring sub found, such sub contained within s[start:end].  optional arguments start , end interpreted in slice notation.  return -1 on failure. 

google words in doc string don't understand, , have answer


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -