← All tips

Python: `str.removeprefix` / `removesuffix`

pythonbasics

Cleaner than slicing for common prefixes/suffixes.

s = 'v1.2.3'
print(s.removeprefix('v'))