统计hamlet中出现词频最高的10个单词

先下载好hamlet的英文版本,用python统计书中出现次数最高的单词 代码如下: def getText(): #处理特殊字符,把文章单词全部变成小写 txt = open(“Hamlet.txt”,“r”).read() txt = txt.lower() for ch in ‘!"#$%&()*+,-./:;<=>[email protected][\]^_‘{|}~’: txt = tx
相关文章
相关标签/搜索