I have a string with which I would like to remove all punctuation. I currently use:
import string
translator = str.maketrans('','', string.punctuation)
name = name.translate(translator)
However, for strings which are names this removed the hyphen also, which I would like to keep in the string. For Instance '\Fred-Daniels!" Should become "Fred-Daniels".
How can I modify the above code to achieve this?