you can also do like this
translator = str.maketrans('', '', string.punctuation) result = input_str.translate(translator)