📌  相关文章
📜  如何在python代码示例中查找字符串中重复次数最多的单词

📅  最后修改于: 2022-03-11 14:46:42.158000             🧑  作者: Mango

代码示例1
from collections import Counter

# Example phrase 
phrase = "John is the son of John second. Second son of John second is William second."
split_phrase = phrase.split()

# create counter object
Counter = Counter(split_phrase)

most_occured_words = Counter.most_common(4)
  
print(most_occured_words)