PyDocs

Nav

Python Runtime Services

bytearray.removesuffix

builtins

method of bytearray · Added in 3.9
  • bytearray.removesuffix(suffix, /)
Return a bytearray with the given suffix string removed if present.

If the bytearray ends with the suffix string and that suffix is not
empty, return bytearray[:-len(suffix)].  Otherwise, return a copy of
the original bytearray.
1 Example
>>> b'MiscTests'.removesuffix(b'Tests')
b'Misc'
>>> b'TmpDirMixin'.removesuffix(b'Tests')
b'TmpDirMixin'
from the Python docs
See Also
No see-alsos for builtins/bytearray.removesuffix
0 Notes
No notes for bytearray.removesuffix