text = " Apple "
x = txt.rstrip()
>>> ' Apple'
x.rstrip('e')
>>> ' Appl'
x.lstrip()
>>> 'Apple'
#python3 program of rstrip method with optional argument
s = "Hello There "
a = "s"
print(s.rstrip()) # prints s without any spaces at the end
print(s.rstrip(a)) # prints s without any characters of value a at the end