@@ -1568,33 +1568,6 @@ expression support in the :mod:`re` module).
1568
1568
interpreted as in slice notation.
1569
1569
1570
1570
1571
- .. method :: str.removeprefix(prefix, /)
1572
-
1573
- If the string starts with the *prefix * string, return
1574
- ``string[len(prefix):] ``. Otherwise, return a copy of the original
1575
- string::
1576
-
1577
- >>> 'TestHook'.removeprefix('Test')
1578
- 'Hook'
1579
- >>> 'BaseTestCase'.removeprefix('Test')
1580
- 'BaseTestCase'
1581
-
1582
- .. versionadded :: 3.9
1583
-
1584
- .. method :: str.removesuffix(suffix, /)
1585
-
1586
- If the string ends with the *suffix * string and that *suffix * is not empty,
1587
- return ``string[:-len(suffix)] ``. Otherwise, return a copy of the
1588
- original string::
1589
-
1590
- >>> 'MiscTests'.removesuffix('Tests')
1591
- 'Misc'
1592
- >>> 'TmpDirMixin'.removesuffix('Tests')
1593
- 'TmpDirMixin'
1594
-
1595
- .. versionadded :: 3.9
1596
-
1597
-
1598
1571
.. method :: str.encode(encoding="utf-8", errors="strict")
1599
1572
1600
1573
Return an encoded version of the string as a bytes object. Default encoding
@@ -1909,6 +1882,34 @@ expression support in the :mod:`re` module).
1909
1882
the string itself, followed by two empty strings.
1910
1883
1911
1884
1885
+ .. method :: str.removeprefix(prefix, /)
1886
+
1887
+ If the string starts with the *prefix * string, return
1888
+ ``string[len(prefix):] ``. Otherwise, return a copy of the original
1889
+ string::
1890
+
1891
+ >>> 'TestHook'.removeprefix('Test')
1892
+ 'Hook'
1893
+ >>> 'BaseTestCase'.removeprefix('Test')
1894
+ 'BaseTestCase'
1895
+
1896
+ .. versionadded :: 3.9
1897
+
1898
+
1899
+ .. method :: str.removesuffix(suffix, /)
1900
+
1901
+ If the string ends with the *suffix * string and that *suffix * is not empty,
1902
+ return ``string[:-len(suffix)] ``. Otherwise, return a copy of the
1903
+ original string::
1904
+
1905
+ >>> 'MiscTests'.removesuffix('Tests')
1906
+ 'Misc'
1907
+ >>> 'TmpDirMixin'.removesuffix('Tests')
1908
+ 'TmpDirMixin'
1909
+
1910
+ .. versionadded :: 3.9
1911
+
1912
+
1912
1913
.. method :: str.replace(old, new[, count])
1913
1914
1914
1915
Return a copy of the string with all occurrences of substring *old * replaced by
0 commit comments