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
用户登录
还没有账号?立即注册
用户注册
投稿取消
| 文章分类: |
|
还能输入300字
上传中....
已认证58290779