MCPcopy Create free account
hub / github.com/RingBDStack/GDAP / list_dictionary

Function list_dictionary

extraction/label_tree.py:6–19  ·  view source on GitHub ↗
(d, n_tab=-1)

Source from the content-addressed store, hash-verified

4
5
6def list_dictionary(d, n_tab=-1):
7 if isinstance(d, list):
8 for i in d:
9 list_dictionary(i, n_tab)
10 elif isinstance(d, dict):
11 n_tab += 1
12 for key, value in d.items():
13 if key == '<end>':
14 print("{}{}".format(" " * n_tab, key))
15 else:
16 print("{}{}".format(" " * n_tab, key))
17 list_dictionary(value, n_tab)
18 else:
19 print("{}{}".format("\t" * n_tab, d))
20
21
22def print_tree(tree):

Callers 1

print_treeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected