Important Notice:

Course Content
The Calendar Module
Library Function/Predefined Functions
0/4
Sys Module
Library Function/Predefined Functions
0/2
OS Module
Library Function/Predefined Functions
0/2
Functions in Python (Chapter-10) M3-R5
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

error: Content is protected !!