Do you want to know the details about “python remove last part of string”. If yes, you’re in the correct tutorial.
python remove last part of string
str = "string" str = str[:-1] # Returns "strin"
#Removing last three characters foo = foo[:-3]
your_string = "hello" your_string = your_string[:-1] # this removes the last character from your string
I hope this tutorial helps you to know about “python remove last part of string”. If you have any queries regarding this tutorial please let us know via the comment section. Share this tutorial with your friends and family via social networks.