May 2018
Intermediate to advanced
380 pages
9h 37m
English
>>> from collections import Counter >>> c = Counter() # a new, empty counter >>> c = Counter('gallahad') # a new counter from an iterable >>> c = Counter({'red': 4, 'blue': 2}) # a new counter from a mapping >>> c = Counter(cats=4, dogs=8) # a new counter from keyword args
>>> c Counter({'a': 3, 'l': 2, 'g': 1, 'h': 1, 'd': 1})