好吧,您真的不需要使用
Counter计数方法,对吗?有一个
+=运算符,它也可以与Counter一起使用。
c = Counter()for item in something: if item.has_some_property: c[item.property] += 1 elif item.has_some_other_property: c[item.other_property] += 1 elif item.has_some.third_property: c[item.third_property] += 1
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)