Skip to content

Commit 80286d3

Browse files
miss-islingtonblaisephugovk
authored andcommitted
[3.14] pythongh-106318: Add example for str.find() (pythonGH-134529) (python#138174)
Co-authored-by: Blaise Pabon <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent ec2094e commit 80286d3

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
@@ -1909,6 +1909,14 @@ expression support in the :mod:`re` module).
19091909
Return the lowest index in the string where substring *sub* is found within
19101910
the slice ``s[start:end]``. Optional arguments *start* and *end* are
19111911
interpreted as in slice notation. Return ``-1`` if *sub* is not found.
1912+
For example::
1913+
1914+
>>> 'spam, spam, spam'.find('sp')
1915+
0
1916+
>>> 'spam, spam, spam'.find('sp', 5)
1917+
6
1918+
1919+
See also :meth:`rfind` and :meth:`index`.
19121920

19131921
.. note::
19141922

0 commit comments

Comments
 (0)