로딩
요청 처리 중입니다...

[python] 중첩 딕셔너리(nested dictionary) 정렬

 [python] 중첩 딕셔너리(nested dictionary) 정렬

중첩 딕셔너리란 (Nested dictionary) dictionary 구조안에 다시 dictionary 가 들어가 있는 데이터 구조 입니다. 이때 어떻게 정렬을 해야하는지 한참을 헤맸는데요, 몇시간 동안 고민한 결과를 정리해 놓습니다.

생각보다 쉬워요! 도움이 되길 바랍니다. 1. dictionary sorting 2. nested dict sorting 예를들면, 사람 A, B, C, D 가 지원을 했고 (각각이 key 값이 됩니다.)

그리고 key 에 따른 value 로는 skill, age, 잘생김 등이 다시 dict type 으로 구성되어 있다고 해봅시다. from pprint import pprint as pp data2 = {'A': {'skill':5, 'age':29, 'handsome':'O'}, "B": {'skill':4, 'age':39,'handsome':'O'}, "D": {'skill':6, 'age':49,'handsome':'X'}, "C": {'sk...

# dict # dictionary # nested # python # sorting # 조경수 # 주니퍼가든 # 중첩dict