Name
find
Synopsis
s
.find(sub
,start
=0,end
=sys.maxint)
Returns the lowest index in s
where
substring sub
is found, such that
sub
is entirely contained in
s
[
start
:end
]
.
For example, 'banana'.find('na')
is
2
, as is 'banana'.find('na',1)
,
while 'banana'.find('na',3)
is
4
, as is
'banana'.find('na',-2)
. find
returns -1
if sub
is
not found.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.