Python String rstrip() method

The string.rstrip() method in Python returns a copy of the string with trailing characters removed.

Syntax

string.rstrip([chars])

Parameter

chars:  This argument represents a string specifying the set of characters to be removed. By default, the chars argument removes the whitespace.

Return

This method returns a copy of the string with trailing characters removed. 

Example 1

Output

Example 2

Output

Example 3

Output

Pin It on Pinterest

Share This