Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Doc/library/stdtypes.rst
Original file line numberDiff line numberDiff line change
Expand Up@@ -1922,6 +1922,8 @@ expression support in the :mod:`re` module).

.. doctest::

>>> 'spam, spam, spam'.index('spam')
0
>>> 'spam, spam, spam'.index('eggs')
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
Expand DownExpand Up@@ -2305,6 +2307,20 @@ expression support in the :mod:`re` module).

Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is not
found.
For example:

.. doctest::

>>> 'spam, spam, spam'.rindex('spam')
12
>>> 'spam, spam, spam'.rindex('eggs')
Traceback (most recent call last):
File "<stdin-0>", line 1, in <module>
'spam, spam, spam'.rindex('eggs')
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
ValueError: substring not found

See also :meth:`index` and :meth:`find`.


.. method:: str.rjust(width, fillchar=' ', /)
Expand Down
Loading