without haste but without rest

[python] Counter 함수 본문

ProgrammingLanguage/Python

[python] Counter 함수

JinungKim 2020. 5. 18. 22:04
from collections import Counter

text = ['apple', 'banana', 'apple', 'orange']
c = Counter(text)


// Counter to dictionary 

from collections import Counter

text = ['apple', 'banana', 'apple', 'orange']
c = dict(Counter(text))
print(c)
print(type(c))

 

언젠가 요긴하게 쓰지 않을까 싶은 함수

Comments