#JavaInspires
Hi Guys,
In this post, we will see rstrip(), lstrip() and strip() functions in python. We can use these functions on string objects only.
Stripping Whitespace Example In Python Program
Code :
affirmation = " i am rich " print(affirmation) #remove whitespace on right side print(affirmation.rstrip()) #remove whitespace on left side print(affirmation.lstrip()) #remove whitespace on both sides print(affirmation.strip())
Output :
i am rich i am rich i am rich i am rich