Python - String Method - rstrip() Tutorial
It will remove any character from the ending( right end) part of the string. by default, it will remove space. To remove another character we need to define it in a parameter of lstrip() method.
Syntax-
String.lstrip(character)
#character - (Optional) A set of multiple character that need to
be removed from ending of a String.by default it will take space
Example-
str1 = " Hello Welcome to python Tutorial "
print(str1.rstrip())
str2 = ",,,].rrHello Pythonggg,,,;;;"
print(str2.rstrip(",.rg;]"))
Output-
Hello Welcome to python Tutorial
,,,].rrHello Python