I need to remove all punctuation marks in the string, as a part of bigger program. It is working when I write it serepatly for each mark like this:
words = [word.replace(".", "") for word in words]
But when I am trying to do it in the loop, it is not working.
line = "I was going to leave her, but in the very last moment I had changed
my mind. Interesting thing, many nice ways to use."
words = line.lower().split()
for punc in [".",","]:
if punc in words:
words = [word.replace(punc, "") for word in words]
print words
Can you please tell me, what I am doing wrong?