Python string rstrip() method

Iyali

Rufe Hanyar Sufuri na Kanamici

txt = "     banana     "
x = txt.rstrip()
print("of all fruits", x, "is my favorite")

Run Iyali

Definition and Usage

rstrip() method deletes all trailing characters (characters at the end of the string), spaces are the default trailing characters to be deleted.

Syntax

string.rstrip(characters)

Values of Parameters

Parameters Bayani
characters Tsarin Yau. Tafakkurin kowane sufuri wanda ake rufe a karshe.

Iyalai Dau Dau

Iyali

Rufe Akwaiyyan Sufuri

txt = "banana,,,,,ssaaww....."
x = txt.rstrip(",.asw")
print(x)

Run Iyali