如何去除Python字符串中的逗号 [英] How to strip comma in Python string
本文介绍了如何去除Python字符串中的逗号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从 Python 字符串(例如 Foo, bar
)中去除逗号?我试过 'Foo, bar'.strip(',')
,但没用.
How can I strip the comma from a Python string such as Foo, bar
? I tried 'Foo, bar'.strip(',')
, but it didn't work.
推荐答案
s = s.replace(',', '')
这篇关于如何去除Python字符串中的逗号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文