【发布时间】:2019-10-30 16:34:06
【问题描述】:
如何删除 . (句号)和,(逗号)出现在python中的数字之间?
示例输入:“衬衫花费 1,50,0,外套花费 1.5.00,帽子花费 2.50。”
示例输出:“衬衫花费 1500,外套花费 1500,帽子花费 250。”
Remove period[.] and comma[,] from string if these does not occur between numbers 的解决方案与上述要求相反。
而re.sub('[.,]','',input) 删除所有逗号和句号。
【问题讨论】:
标签: python regex python-3.x