PyDocs

Nav

Python Runtime Services

bytearray.removeprefix

builtins

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

If the bytearray starts with the prefix string, return
bytearray[len(prefix):].  Otherwise, return a copy of the original
bytearray.
1 Example
>>> b'TestHook'.removeprefix(b'Test')
b'Hook'
>>> b'BaseTestCase'.removeprefix(b'Test')
b'BaseTestCase'
from the Python docs
See Also
No see-alsos for builtins/bytearray.removeprefix
0 Notes
No notes for bytearray.removeprefix