python:collections模块
生活随笔
收集整理的這篇文章主要介紹了
python:collections模块
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Counter類
介紹:A counter tool is provided to support convenient and rapid tallies
構(gòu)造:class?collections.Counter([iterable-or-mapping])
是dict的子類:取:c['cats'],返回個數(shù)值;賦:c['cats'] = 0
方法:
elements()返回元素
most_common([n])
subtract([iterable-or-mapping])
fromkeys(iterable)
update([iterable-or-mapping])
?
文檔:
Python中Collections模塊的Counter容器類使用教程
counter類官網(wǎng)https://docs.python.org/3.5/library/collections.html#collections.Counter
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/daduryi/p/6877278.html
總結(jié)
以上是生活随笔為你收集整理的python:collections模块的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql-学习-7-20170517-
- 下一篇: python_day6 shutil模块