File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff 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,12 +2380,16 @@ 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
23842388 If the string ends with the *suffix * string and that *suffix * is not empty,
23852389 return ``string[:-len(suffix)] ``. Otherwise, return a copy of the
2386- original string::
2390+ original string:
2391+
2392+ .. doctest ::
23872393
23882394 >>> ' MiscTests' .removesuffix(' Tests' )
23892395 'Misc'
@@ -2392,6 +2398,8 @@ expression support in the :mod:`re` module).
23922398
23932399 .. versionadded :: 3.9
23942400
2401+ See also :meth: `removeprefix ` and :meth: `endswith `.
2402+
23952403
23962404.. method :: str.replace(old, new, /, count=-1)
23972405
You can’t perform that action at this time.
0 commit comments