Skip to content

Commit 37cef7e

Browse files
committed
gh-106318: Add doctest role and 'See also' for str.removeprefix()
1 parent cea2d24 commit 37cef7e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Doc/library/stdtypes.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2369,7 +2369,9 @@ expression support in the :mod:`re` module).
23692369

23702370
If the string starts with the *prefix* string, return
23712371
``string[len(prefix):]``. Otherwise, return a copy of the original
2372-
string::
2372+
string:
2373+
2374+
.. doctest::
23732375

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

23792381
.. versionadded:: 3.9
23802382

2383+
See also :meth:`removesuffix` and :meth:`startswith`.
2384+
23812385

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

0 commit comments

Comments
 (0)