def unpunctuate ( s , * , char_blacklist = string . punctuation ) : # remove punctuation s = "" . join ( c for c in s if c not in char_blacklist ) # remove consecutive spaces return " " . join ( filter ( None , s . split ( " " ) ) )
python eliminate spaces in a string
Remove punctuation from string s .
def unpunctuate(s, *, char_blacklist=string.punctuation):
    """ Remove punctuation from string s. """
    # remove punctuation
    s = "".join(c for c in s if c not in char_blacklist)
    # remove consecutive spaces
    return " ".join(filter(None, s.split(" ")))