相关疑难解决方法(0)

替换位于其间的字符串

这里是我的问题:在一个变量,文本和包含逗号,我尝试删除只设两个字符串(事实上之间的逗号[]).例如,使用以下字符串:

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."
Run Code Online (Sandbox Code Playgroud)

我知道如何使用.replace整个变量,但我不能为它的一部分做.这个网站上有一些主题正在接近,但我没有设法利用它们来解决我自己的问题,例如:

python regex string

15
推荐指数
1
解决办法
2万
查看次数

标签 统计

python ×1

regex ×1

string ×1