Skip to content

Commit d6f7c61

Browse files
miss-islingtonblaisephugovk
authored
[3.13] gh-106318: Add example for str.find() (GH-134529) (#138175)
Co-authored-by: Blaise Pabon <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 238a1ca commit d6f7c61

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
@@ -1775,6 +1775,14 @@ expression support in the :mod:`re` module).
17751775
Return the lowest index in the string where substring *sub* is found within
17761776
the slice ``s[start:end]``. Optional arguments *start* and *end* are
17771777
interpreted as in slice notation. Return ``-1`` if *sub* is not found.
1778+
For example::
1779+
1780+
>>> 'spam, spam, spam'.find('sp')
1781+
0
1782+
>>> 'spam, spam, spam'.find('sp', 5)
1783+
6
1784+
1785+
See also :meth:`rfind` and :meth:`index`.
17781786

17791787
.. note::
17801788

0 commit comments

Comments
 (0)