Python用三種方式統計詞頻

三種方法:python ①直接使用dict函數 ②使用defaultdictspa ③使用Counter ps:`int()`函數默認返回0 ①dictcode text = "I'm a hand some boy!" frequency = {} for word in text.split(): if word not in frequency: frequenc
相關文章
相關標籤/搜索