Dec 14, 2019 in Python
Q: What Is Rstrip() In Python?

1 Answer

Dec 14, 2019
Python provides the rstrip() method which duplicates the string but leaves out the whitespace characters from the end.

The rstrip() escapes the characters from the right end based on the argument value, i.e., a string mentioning the group of characters to get excluded.

The signature of the rstrip() is:

str.rstrip([char sequence/pre>


test_str = 'Programming    '

# The trailing whitespaces are excluded

Click here to read more about Python
Click here to read more about Insurance

Related questions

Aug 30 in Python
Aug 30 in Python
Aug 29 in Python