-
[Python] One-line Tree in PythonEngineering WIKI/Python 2021. 2. 21. 19:29
- 파이썬 이중 딕셔너리 구조 생성
def tree(): return defaultdict(tree) users = tree() users['harold']['username'] = 'hrldcpr' users['handler']['username'] = 'matthandlersux' print(json.dumps(users)) # result {"harold": {"username": "hrldcpr"}, "handler": {"username": "matthandlersux"}}
'Engineering WIKI > Python' 카테고리의 다른 글
알고리즘 INPUT값 TXT 파일로 입력하기 (Feat. VSC) (0) 2022.04.07 Class Advanced (0) 2022.04.06 [Python] itertools 완전탐색 (0) 2022.03.06 [Python] FastAPI 사용법 (0) 2021.04.13 [Python] pyinstaller 실행파일 생성 (0) 2021.02.21 Pandas 텍스트(txt) 파일 불러오기 및 저장하기 (0) 2021.02.03 [Python] 소요시간 측정방법 (0) 2020.12.09 [Python] Coding Test Tip (0) 2020.12.09