Skip to content

Latest commit

 

History

History
9 lines (6 loc) · 196 Bytes

File metadata and controls

9 lines (6 loc) · 196 Bytes

string removeprefix

str.removeprefix() and str.removesuffix() added in Python 3.9. Cleaner than slicing.

'test_file.py'.removeprefix('test_')  # 'file.py'

Learned on 2025-05-19