diff options
author | sweeneyde <36520290+sweeneyde@users.noreply.github.com> | 2020-04-22 21:05:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-22 21:05:48 (GMT) |
commit | a81849b0315277bb3937271174aaaa5059c0b445 (patch) | |
tree | 8184e6ab012aa217b5cc1bb242efc6aed531db7d /Doc/whatsnew | |
parent | 39652cd8bdf7c82b7c6055089a4ed90ee546a448 (diff) | |
download | cpython-a81849b0315277bb3937271174aaaa5059c0b445.zip cpython-a81849b0315277bb3937271174aaaa5059c0b445.tar.gz cpython-a81849b0315277bb3937271174aaaa5059c0b445.tar.bz2 |
bpo-39939: Add str.removeprefix and str.removesuffix (GH-18939)
Added str.removeprefix and str.removesuffix methods and corresponding
bytes, bytearray, and collections.UserString methods to remove affixes
from a string if present. See PEP 616 for a full description.
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/3.9.rst | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index 8064785..ee85170 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -105,6 +105,16 @@ Merge (``|``) and update (``|=``) operators have been added to the built-in :class:`dict` class. See :pep:`584` for a full description. (Contributed by Brandt Bucher in :issue:`36144`.) +PEP 616: New removeprefix() and removesuffix() string methods +------------------------------------------------------------- + +:meth:`str.removeprefix(prefix)<str.removeprefix>` and +:meth:`str.removesuffix(suffix)<str.removesuffix>` have been added +to easily remove an unneeded prefix or a suffix from a string. Corresponding +``bytes``, ``bytearray``, and ``collections.UserString`` methods have also been +added. See :pep:`616` for a full description. (Contributed by Dennis Sweeney in +:issue:`18939`.) + Other Language Changes ====================== |