How to remove last character from Python string?
Advertisements
We can use the slicing in Python to remove the last character from a string in Python.
name = 'Poopcode' print(name[:-1]) #Poopcod print(name[:-2]) #Poopco