源代码
txt = "banana,,,,,ssqqqww....." x = txt.rstrip(",.qsw") print(x)
运行结果