Cody Bable

Generation

generate functionWed, 19 Apr 2023

remove punctuations from a sentence and split the sentence into a list

def remove_punc_and_split(s): return "".join([w for w in s if w not in string.punctuation]).split() remove_punc_and_split("I love NLP!")

Questions about programming?Chat with your personal AI assistant