tags:

views:

87

answers:

1

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" 
+6  A: 
>>> "    xyz     ".rstrip()
'    xyz'

more about rstrip in docs

SilentGhost