demo_ref_string_rstrip2.py:
txt = "banana,,,,,ssqqqww....." x = txt.rstrip(",.qsw") print(x)
➜ begtut>python demo_string_rstrip2.py
banana