언어/python cheatsheet

원소 수세기 : Counter

nanon 2019. 10. 8. 14:24

리스트 안에 있는 원소별 개수를 세어서 dictionary로 return

 

from collections import Counter

 

c = Counter([list])

 

리스트 안의 특정 element의 개수

list.count([element])