how to use the strip function in python code example
Example 1: 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!!!
Example 2: strip in python
txt = " banana "
x = txt.strip()
#x will be "banana"
Example 3: python strip
txt = " test "
txt.strip()
#Output: "test"
txt.lstrip()
#Output: "test "
txt.rstrip()
#Output: " test"
Example 4: strip()
txt = ",,,,,rrttgg.....banana....rrr"
x = txt.strip(",.grt")
#outputs banana
print(x)