[Python] dictionary filter

2020. 9. 12. 12:24분석 Python/구현 및 자료

728x90

dict에서 value나 key에 따라서 필터링을 하고 싶은 경우에 사용하면 좋을 것 같아서 공유

 

아래는 key안에 value의 길이가 3 이상인 애들만 추출하기

dict(filter(lambda elem: len(elem[1]) >=3, data.items()))

 

아래 참고!

 

 

hello-bryan.tistory.com/77

 

[Python] Dictionary Filter

Dictionary Filter score_dict = { 'sam':23, 'john':30, 'mathew':29, 'riti':27, 'aadi':31, 'sachin':28 } 이런 dictionary 가 있을 때 30점이 넘는 사람만 가지는 dictionary 를 얻고 싶다면, 기본 적으로 for..

hello-bryan.tistory.com

 

728x90