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"
python
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"
Best Answer
There is more about
rstrip
in the documentation.