counter
-
[Python] - Counter개발/Python 2022. 7. 27. 20:24
Counter A Counter is a dict subclass for counting hashable objects. collection where elements are stored as dictionary keys and their counts are stored as dictionary values. Syntax Counter([iterable-or-mapping]) from collections import Counter c = Counter('gallahad') > Counter({'a': 3, 'l': 2, 'g': 1, 'h': 1, 'd': 1}) c = Counter({'red': 4, 'blue': 2}) > Counter({'red': 4, 'blue': 2}) c = Counte..