Strings In Depth17 / 19
Up next

Strip a prefix or suffix

print("unhappy".removeprefix("un"))     # happy
print("report.txt".removesuffix(".txt")) # report
What you're solving

removeprefix / removesuffix (3.9+)