I don’t know about “standard way”.
def remove_prefix(text, prefix):
if text.startswith(prefix):
return text[len(prefix):]
return text # or whatever
As noted by @Boris and @Stefan, on Python 3.9+ you can use
text.removeprefix(prefix)
with the same behavior.