Discuss / Python / Counter函数直接用就好

Counter函数直接用就好

Topic source

赵彬RobinZ

#1 Created at ... [Delete] [Delete and Lock User]

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})

丶10年_892

#2 Created at ... [Delete] [Delete and Lock User]
dict = Counter('Programming')

直接这么用就行。。。。


  • 1

Reply