num_words = len(re.sub('[^a-zA-Z0-9 ]', '', x).split())
print("""Characters:{0}
Words:{1}
Average word length: {2}""".format(
    total_chars, num_words, total_chars / float(num_words)))
phrase = '***The ?! quick brown cat:  leaps over the sad boy.'
Finding average word length in a string