from itertools import *

def getWords(text):
    return [''.join(chars) for isWord, chars in groupby(
        ' My name, is test!', lambda c: c.isalnum()) if isWord]
Extracting words from a string, removing punctuation and returning a list with separated words in Python