Write a function to remove punctuation from the string
Topic: Write a function to remove punctuation from the string
Solution
def r_punc(): test_str = "end, is best : for ! Nlp ;" print("The original string is : " + test_str) punc = r'!()-[]{};:\, <>./?@#$%^&*_~' for ele in test_str: if ele in punc: test_str = test_str.replace(ele, "") print("The string after punctuation filter : " + test_str)
List all Python Programs