Python String removeprefix() Method Syntax

Syntax: str_obj_name.removeprefix(prefix

Parameters: prefix– prefix string that we are checking for.

Return: Returns the copy of the string with the prefix removed(if present), else the original string.

Python String – removeprefix() function

Python String removeprefix() function removes the prefix and returns the rest of the string. If the prefix string is not found, then it returns the original string. It is introduced in Python 3.9.0 version.

Similar Reads

Python String removeprefix() Method Syntax

Syntax: str_obj_name.removeprefix(prefix Parameters: prefix– prefix string that we are checking for. Return: Returns the copy of the string with the prefix removed(if present), else the original string....

Python String removeprefix() Method Example

Python3 new_string = 'GeeksforGeeks'.removeprefix("Geeksfor") print(new_string)...