Goodspeed

导航

2012年8月6日 #

Python容器数据类型——collections

摘要: #!/usr/bin/python#coding=utf-8#http://docs.python.org/library/collections.html#count对象 Only 2.7from collections import Counter#统计字母出现的次数Counter('hello world') Counter(['red', 'blue', 'red', 'green', 'blue', 'blue']) #小于等于0的会被忽略c = Counter(a=4, 阅读全文

posted @ 2012-08-06 13:58 Goodspeed 阅读(3762) 评论(0) 推荐(0) 编辑