使用此代码,我首先打印所有使用文本文件中使用的最常用单词排序的元素.但是我如何打印前十个元素?
with open("something.txt") as f: words = Counter(f.read().split()) print(words)
python counter
counter ×1
python ×1