Counter函数直接用就好
在此插入代码 >>> from collections import Counter >>> c=Counter >>> c('Programming') Counter({'r': 2, 'm': 2, 'g': 2, 'P': 1, 'a': 1, 'o': 1, 'i': 1, 'n': 1})
dict = Counter('Programming')
直接这么用就行。。。。
https://docs.python.org/3/library/collections.html?highlight=counter#collections.Counter
Sign in to make a reply
赵彬RobinZ
Counter函数直接用就好