相关疑难解决方法(0)

从Python中删除字符串标点符号的最佳方法

似乎应该有一个比以下更简单的方法:

import string
s = "string. With. Punctuation?" # Sample string 
out = s.translate(string.maketrans("",""), string.punctuation)
Run Code Online (Sandbox Code Playgroud)

在那儿?

python string punctuation

578
推荐指数
20
解决办法
65万
查看次数

标签 统计

punctuation ×1

python ×1

string ×1