x.strip() code example Example: strip() txt = ",,,,,rrttgg.....banana....rrr" x = txt.strip(",.grt") #outputs banana print(x)