Word frequency analysis

Write a program that reads a file, breaks each line into words, scripts whitespace and punctuation from the words, and converts them to lowercase. Modify the program to print the 20 most frequently-used words in the book.

First I downloaded the e-book ‘ELSIE'S WINTER TRIP’ in the below dictionary:

                       

 

Scripts:

 

 

 

from Thinking in Python

posted @ 2014-08-10 21:38  平静缓和用胸音说爱  阅读(311)  评论(0编辑  收藏  举报