import string
res = ['my', '/my', ',i', 'i', 'i', 'nnn', 'm.', "'sd'"]
out = []
for i in res:
tmp = str.maketrans({key: None for key in string.punctuation})
j = i.translate(tmp)
out.append(j)
print(res)
print(out)
# ['my', '/my', ',i', 'i', 'i', 'nnn', 'm.', "'sd'"]
# ['my', 'my', 'i', 'i', 'i', 'nnn', 'm', 'sd']
猜你喜欢:👇🏻
⭐【Python】分割字符串 空格、逗号,分号;
⭐【Python】判断字符串 str 是否为空
⭐【Python】字符转换为 ASCII 码