【发布时间】:2012-06-21 05:48:00
【问题描述】:
这是我的问题:在一个包含逗号的文本变量中,我尝试仅删除位于两个字符串之间的逗号(实际上是[ 和])。例如使用以下字符串:
input = "The sun shines, that's fine [not, for, everyone] and if it rains, it Will Be better."
output = "The sun shines, that's fine [not for everyone] and if it rains, it Will Be better."
我知道如何对整个变量使用.replace,但我不能对其中的一部分使用。
这个网站上有一些主题,但我没有设法利用它们来解决我自己的问题,例如:
【问题讨论】: