【发布时间】:2020-04-25 22:51:28
【问题描述】:
punctuation_chars = ["'", '"', ",", ".", "!", ":", ";", '#', '@']
def strip_punctuation(word):
for i in punctuation_chars:
if i in word:
word = word.replace(i, '')
return word
print(strip_punctuation('GH.GH,GHGH:GHGH;GHGHG@'))
【问题讨论】:
-
你的 return 缩进是问题。
标签: python python-3.x replaceall