Add autogenerated help.
This commit is contained in:
parent
091db860c2
commit
af0881b823
3 changed files with 58 additions and 31 deletions
15
dtk/aux.py
Normal file
15
dtk/aux.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
#! /usr/bin/env python3
|
||||
# encoding: utf-8
|
||||
|
||||
def flatten_dict(root, glue=" ", prefix=[]):
|
||||
lines = []
|
||||
|
||||
for k, v in root.items():
|
||||
new_prefix = prefix + [k]
|
||||
|
||||
if type(v) == dict:
|
||||
lines.extend(flatten_dict(v, glue, new_prefix))
|
||||
else:
|
||||
lines.append((glue.join(new_prefix), v))
|
||||
|
||||
return lines
|
Loading…
Add table
Add a link
Reference in a new issue