PyDocs

Nav

Python Runtime Services

bytes.removeprefix

builtins

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

If the bytes starts with the prefix string, return
bytes[len(prefix):].  Otherwise, return a copy of the original
bytes.
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/bytes.removeprefix
0 Notes
No notes for bytes.removeprefix