find() function in python2.7.5

后端 未结 2 1336
一个人的身影
一个人的身影 2021-01-16 11:21

find(\'asdf\',\'\') finds an empty string in \'asdf\' hence it returns 0. Similarly, find(\'asdf\',\'\',3) starts to sea

2条回答
  •  有刺的猬
    2021-01-16 11:23

    Because "asdf" without its first four characters still does contain "". A harder check comes into play when the index exceeds the length of the string, but having an index equal to the string is equivalent to "".find().

提交回复
热议问题