Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

function to remove punctuation in python

import string

def remove_punctuation(text):
    '''a function for removing punctuation'''
    # replacing the punctuations with no space, 
    # which in effect deletes the punctuation marks 
    translator = str.maketrans('', '', string.punctuation)
    # return the text stripped of punctuation marks
    return text.translate(translator)
Source by itsmycode.com #
 
PREVIOUS NEXT
Tagged: #function #remove #punctuation #python
ADD COMMENT
Topic
Name
6+7 =