feeling stupid with this one :/
I know I'm using the method wrong in some way, but with only https://docs.python.org/3/library/stdtypes.html#str.replace 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?)
import string
word2 = 'abc?ef,hi.!l@'
for x in string.punctuation:
if x in word2:
word2.replace(x,'')
print (word2)
I've tried a few debugs & 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?
Thanks