mirror of
https://github.com/python/cpython.git
synced 2026-01-26 21:03:34 +00:00
[3.14] gh-106318: Add examples for str.rfind() method (GH-143582) (#143616)
gh-106318: Add examples for str.rfind() method (GH-143582) (cherry picked from commit c696f33d9ee425d7acd5de90d5418a3280444962) Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
This commit is contained in:
parent
ae62d2bb31
commit
426683e7b7
@ -2416,6 +2416,16 @@ expression support in the :mod:`re` module).
|
||||
Return the highest index in the string 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.
|
||||
For example:
|
||||
|
||||
.. doctest::
|
||||
|
||||
>>> 'spam, spam, spam'.rfind('sp')
|
||||
12
|
||||
>>> 'spam, spam, spam'.rfind('sp', 0, 10)
|
||||
6
|
||||
|
||||
See also :meth:`find` and :meth:`rindex`.
|
||||
|
||||
|
||||
.. method:: str.rindex(sub[, start[, end]])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user