Desired Outcome Is = ["This", "is", "a", "random", "sentence"]
text = "Th,is is a? random!! sentence..." # Eddied, added comma inside word
clean_text = text.split()
for clean in clean_text:
double_clean_text = clean.strip(",.!?")
print(double_clean_text)
设法清理了,但我怎样才能把它全部恢复到列表中
这是有效的方法吗
您可以使用列表理解:
您可以执行以下操作:
试试这个:
或
相关问题 更多 >
编程相关推荐