Skip to content
Merged
Changes from 1 commit
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
Next Next commit
gh-106318: Add doctest role and 'See also' for str.removeprefix()
  • Loading branch information
adorilson committed Jan 8, 2026
commit 37cef7e6235642f06879c3f6662faace8cb6a1c8
6 changes: 5 additions & 1 deletion Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2369,7 +2369,9 @@ expression support in the :mod:`re` module).

If the string starts with the *prefix* string, return
``string[len(prefix):]``. Otherwise, return a copy of the original
string::
string:

.. doctest::

>>> 'TestHook'.removeprefix('Test')
'Hook'
Expand All @@ -2378,6 +2380,8 @@ expression support in the :mod:`re` module).

.. versionadded:: 3.9

See also :meth:`removesuffix` and :meth:`startswith`.


.. method:: str.removesuffix(suffix, /)

Expand Down
Loading