Question
Asked By – Pablo
I need to remove whitespaces after the word in the string. Can this be done in one line of code?
Example:
string = " xyz "
desired result : " xyz"
Now we will see solution for issue: How do I remove whitespace from the end of a string in Python?
Answer
>>> " xyz ".rstrip()
' xyz'
There is more about rstrip
in the documentation.
This question is answered By – SilentGhost
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0