Answers for "rstrip()"

7

what is r strip function in python

#!/usr/bin/python

str = "     this is string example....wow!!!     ";
print str.rstrip()
str = "88888888this is string example....wow!!!8888888";
print str.rstrip('8')

#the answer

#this is string example....wow!!!
#88888888this is string example....wow!!!
Posted by: Guest on May-30-2020
0

rstrip()

# Only trailing whitespaces are removed
text1 = '   Python Programming   '
print(text1.rstrip())


# Remove the whitespace and specified character at
# trailing end
text2 = '       code its my code        '
print(text2.rstrip(' code'))

# Remove the specified character at 
# trailing end
text3 = 'code its my code'
print(text3.rstrip('code'))
Posted by: Guest on September-25-2021
0

rstrip python3

#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
Posted by: Guest on August-22-2020

Python Answers by Framework

Browse Popular Code Answers by Language