.strip() in python code example
Example 1: strip in python
txt = " banana "
x = txt.strip()
Example 2: python strip
' hey '.strip()
' hey '.lstrip()
' hey '.rstrip()
'_.hey__'.strip('._')
Example 3: strip()
txt = ",,,,,rrttgg.....banana....rrr"
x = txt.strip(",.grt")
print(x)
Example 4: python input().strip()
txt = " banana "
x = txt.strip()
print("of all fruits", x, "is my favorite")
txt = ",,,,,rrttgg.....banana....rrr"
x = txt.strip(",.grt")
print(x)
Example 5: python strip()
a = " smurf "
a = a.strip()
print(a)