python詞頻統計

統計一篇英語文章中單詞出現的次數,而後以單詞出現頻率從大到小輸出 import string path = 'D:/WorkSpace/test02/Walden.txt' with open(path, 'r') as text: words = [raw_word.strip(string.punctuation).lower() for raw_word in text.read(
相關文章
相關標籤/搜索