1# removes outside whitespace/characters
2' hey '.strip() # "hey"
3' hey '.lstrip() # "hey "
4' hey '.rstrip() # " hey"
5'_.hey__'.strip('._') # "hey"
1txt = " test "
2
3txt.strip()
4#Output: "test"
5
6txt.lstrip()
7#Output: "test "
8
9txt.rstrip()
10#Output: " test"
1txt = ",,,,,rrttgg.....banana....rrr"
2x = txt.strip(",.grt")
3#outputs banana
4print(x)
1lol = ' lol '
2print(lol)
3# normal output = lol
4lol = ' lol '
5print(lol.strip())
6# strip output = lol
7# Cool right
8
1string = ' xoxo love xoxo '
2
3# Leading and trailing whitespaces are removed
4print(string.strip())
5
6# All <whitespace>,x,o,e characters in the left
7# and right of string are removed
8print(string.strip(' xoe'))
9
10# Argument doesn't contain space
11# No characters are removed.
12print(string.strip('stx'))
13
14string = 'android is awesome'
15print(string.strip('an'))