Python replace/delete special characters
Question: 
    character = (%.,-();'0123456789-—:`’)
    character.replace(" ")
    character.delete()
    

I want to delete or replace all the special characters and numbers from my
program, I know it can be done in the one string just not sure how to space
all the special characters with quotes or anything. Somehow I'm supposed to
separate all the special character in the parenthesis just not sure how to
break up and keep all the characters stored in the variable.


Answer: The `translate` method is my preferred way of doing this. Create a mapping
between the chars you want mapped and then apply that table to your input
string.

    
    
    from string import maketrans
    
    special = r"%.,-();'0123456789-—:`’" 
    blanks = " " * len(special)
    table = maketrans(special, blanks)
    input_string.translate(table)
    

