2018-11-19
阅读量:
977
find
方法find在字符串中查找子串。如果找到,就返回子串的第一个字符的索引,否则返回-1。
>>> 'With a moo-moo here, and a moo-moo there'.find('moo') 7
>>> title = "Monty Python's Flying Circus"
>>> title.find('Monty') 0
>>> title.find('Python')
6
>>> title.find('Flying') 15
>>> title.find('Zirquss')
-1






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论