공부
[Python] counter
승가비
2020. 4. 26. 02:56
728x90
from collections import Counter
Counter('hello world')
# ({'l': 3, 'o': 2, 'h': 1, 'e': 1, ' ': 1, 'w': 1, 'r': 1, 'd': 1})
Counter('hello world').most_common()
# [('l', 3), ('o', 2), ('h', 1), ('e', 1), (' ', 1), ('w', 1), ('r', 1), ('d', 1)]
Counter('hello world').most_common(1)
# [('l', 3)]
https://www.daleseo.com/python-collections-counter/
[파이썬] collections 모듈의 Counter 클래스 사용법
Engineering Blog by Dale Seo
www.daleseo.com
https://www.journaldev.com/20806/python-counter-python-collections-counter
Python Counter - Python Collections Counter - JournalDev
Python Counter, Python collections Counter, Python Counter most common, least common elements, Python counter elements(), Python Counter delete an element, arithmetic operations.
www.journaldev.com
728x90