Python String | rstrip()
Python String rstrip() Method The Python string rstrip() method returns a copy of the string with the trailing characters removed (based on the string argument passed). If no parameters are passed, it removes trailing spaces. Syntax: string.rstrip([chars]) Parameters: chars (optional)…