用户登录
用户注册

分享至

文件结构扁平化

  • 作者: 已认证58290779
  • 来源: 51数据库
  • 2022-08-12
def flatten(dictionary):
    stack = [((), dictionary)]
    result = {}
    while stack:
        path, current = stack.pop()
        if not current:
            result["/".join((path ))] = ""
        for k, v in current.items():
            if isinstance(v, dict):
                stack.append((path + (k,), v))
            else:
                result["/".join((path + (k,)))] = v
    return result
软件
前端设计
程序设计
Java相关