#!/usr/bin/python3
# -*- coding: utf-8 -*-
import split
from collections import Counter
def wordCount():
myString = ('my english name is thousand lee')
list = myString.split()
count = Counter(list)
print(count)
return
wordCount()
輸出結果
Counter({'my': 1, 'english': 1, 'name': 1, 'is': 1, 'thousand': 1, 'lee': 1})
Process finished with exit code 0