ID EN
Built-in Types

removeprefix

Python 3.11

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string:

Syntax

PYTHON
str.removeprefix(prefix, /)

Examples

Example 1
PYTHON
>>> 'TestHook'.removeprefix('Test')
'Hook'
>>> 'BaseTestCase'.removeprefix('Test')
'BaseTestCase'