diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index ae197f765d1e16..b28eb787f73b2e 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -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' @@ -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, /)