Remove characters from string using replace()
<p>feeling stupid with this one :/</p>

<p>I know I'm using the method wrong in some way, but with only <a href="https://docs.python.org/3/library/stdtypes.html#str.replace" rel="nofollow">https://docs.python.org/3/library/stdtypes.html#str.replace</a> to work with I just can't see why I can't do what I'm trying to achieve here (which I hope is obvious enough?)</p>

<pre><code>import string

word2 = 'abc?ef,hi.!l@'

for x in string.punctuation:
    if x in word2:
        word2.replace(x,'')

print (word2)
</code></pre>

<p>I've tried a few debugs &amp; print statements so I know it's iterating through string.substring OK, and I know it's going through word2 and recognising when each x is present, but why isn't replace() actually doing anything here?</p>

<p>Thanks</p>