rstrip( ) method

 

Definition and Usage

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)

Parameter Values

ParameterDescription
charactersOptional. A set of characters to remove as trailing characters

More Examples

Example

Remove the trailing characters if they are commas, s, q, or w:

txt = "banana,,,,,ssqqqww....."

x = txt.rstrip(",.qsw")

print(x)
##Output:-
banana

Comments

Popular posts from this blog

XAMPP, SQL BASIC COMMANDS

The Minion Game Hackerrank Solution

Arrays - DS | HackerRank Solutions