Deleting a particular character from a string in python -
this question has reply here:
python: delete character string 3 answerslet's have string "puete" , want delete lastly "e", how can it?
i have used del[len(str)-1] there error showing 'str not back upwards item deletion'.
str objects don't back upwards item deletion because they're immutable. closest can create new string w/out lastly character slicing string:
in [20]: 'puete'[:-1] out[20]: 'puet' python python-3.x
No comments:
Post a Comment