Skip to content

Commit 14a5ad1

Browse files
blaisephugovk
andauthored
gh-106318: Add example for str.find() (#134529)
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent ffaec6e commit 14a5ad1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Doc/library/stdtypes.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,6 +1911,14 @@ expression support in the :mod:`re` module).
19111911
Return the lowest index in the string where substring *sub* is found within
19121912
the slice ``s[start:end]``. Optional arguments *start* and *end* are
19131913
interpreted as in slice notation. Return ``-1`` if *sub* is not found.
1914+
For example::
1915+
1916+
>>> 'spam, spam, spam'.find('sp')
1917+
0
1918+
>>> 'spam, spam, spam'.find('sp', 5)
1919+
6
1920+
1921+
See also :meth:`rfind` and :meth:`index`.
19141922

19151923
.. note::
19161924

0 commit comments

Comments
 (0)