Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
入力
str = 'test1,test2,test3,'
出力
str = 'test1,test2,test3'
「、」の最後の出現を削除する要件
rstrip()を使用するだけです。
result = your_string.rstrip(',')
str = 'test1,test2,test3,' str[:-1] # 'test1,test2,test3'