Answers for "what are rstrip used for in python"

5

rstrip in python

text = "     Apple      "
x = txt.rstrip()
>>> '     Apple'
x.rstrip('e')
>>> '  Appl'
x.lstrip()
>>> 'Apple'
Posted by: Guest on March-09-2021
0

rstrip python

text = "   hello   "

text = text.lstrip() # lstrip == left strip
>>> '   hello' 

text = text.rstrip() # rstrip == right strip
>>> 'hello   '

text = text.strip() # strip == strip from both sides
>>> 'hello'
Posted by: Guest on August-22-2021

Code answers related to "what are rstrip used for in python"

Python Answers by Framework

Browse Popular Code Answers by Language