我需要在字符串中的单词之后删除空格。可以用一行代码完成吗?
例:
string = " xyz " desired result : " xyz"
>>> " xyz ".rstrip() ' xyz'
更多关于rstrip在文档
rstrip