파이썬 딕셔너리 구조
-
[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"}}