热线电话:13121318867

登录
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.0000
1
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子