About Lesson
rstrip():-
The rstrip() method removes any trailing characters (characters at the end a string), space is the default trailing character to remove.
Syntax:- string.rstrip(characters)
txt = ” banana “ x = txt.rstrip() print(“of all fruits”, x, “is my favorite”) Output of all fruits banana is my favorite |
txt = “banana,,,,,ssqqqww…..” x = txt.rstrip(“,.qsw”) print(x) Output banana |