首页 > 其他 > 详细

字符串find

时间:2018-10-29 13:51:11      阅读:160      评论:0      收藏:0      [点我收藏+]
    def find(self, sub, start=None, end=None): # real signature unknown; restored from __doc__
        """
        S.find(sub[, start[, end]]) -> int
        
        Return the lowest index in S where substring sub is found,
        such that sub is contained within S[start:end].  Optional
        arguments start and end are interpreted as in slice notation.
        
        Return -1 on failure.
        """
        return 0
name="wesley hello world wesley wesley"
ret=name.find(he,2,8)
print(ret)         #找不到返回-1
ret=name.find(e)
print(ret)  #找到返回索引

-1
1

 

字符串find

原文:https://www.cnblogs.com/wuxi9864/p/9870140.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!