【发布时间】:2012-09-08 09:28:30
【问题描述】:
我想替换(而不是删除)Python中字符串中的所有标点符号“”。
下面的味道有什么有效的吗?
text = text.translate(string.maketrans("",""), string.punctuation)
【问题讨论】:
-
REMOVE 和 REPLACE with nothing 有什么区别??
-
否,替换为“”(空格)