一个小示例

from collections import  defaultdict
import json


def tree():
    return defaultdict(tree)


users = tree()
users['harold']['username'] = 'hrldcpr'
users['handler']['username'] = 'matthandlersux'

print(json.dumps(users))

输出:

{"harold": {"username": "hrldcpr"}, "handler": {"username": "matthandlersux"}}

相关文章:

  • 2022-02-17
  • 2022-02-26
  • 2021-09-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
猜你喜欢
  • 2021-07-04
  • 2021-12-26
  • 2021-10-11
  • 2021-06-09
  • 2021-10-06
  • 2022-01-11
相关资源
相似解决方案