Python delete in a string

后端 未结 4 1654
长情又很酷
长情又很酷 2021-01-21 08:51

I have these 3 strings:

YELLOW,SMALL,STRETCH,ADULT,T21fdsfdsfs
YELLOW,SMALL,STRETCH,ADULT,Tdsfs
YELLOW,SMALL,STRETCH,ADULT,TD

4条回答
  •  渐次进展
    2021-01-21 09:06

    s.rsplit(',', 1)[0]
    

    Anyway, I suggest having a look at Ignacio Vazquez-Abrams's answer too, it might make more sense for your problem.

提交回复
热议问题