The rstrip, strip, and lstrip functions are mainly used to remove the character that meets the conditions in the string. The input parameters are a character array, which respectively indicate matching and removing the characters on the right, both sides, and left.
When no parameter is input, strip () indicates removing spaces at the beginning and end. The same applies to the other two functions.
Code:
>>> STR = '\ tgood to say you, you are a good guys! Doddoog! \ N'
>>> Nospace = Str. Strip ()
>>> Nospace
'Good to say you, you are a good guys! Doddoog! '
>>> Nospace. Strip ('Go! Od ')
'To say you, you are a good guys'
>>> Nospace. lstrip ('Go! Od ')
'To say you, you are a good guys! Doddoog! '
>>> Nospace. rstrip ('Go! Od ')
'Good to say you, you are a good guys'
>>>
Str. rstrip ('\ n \ R') is the most used in applications, and a line break is used between systems.