MCPcopy Create free account
hub / github.com/IrakliXYZ/ARBOT / table

Function table

builder.py:14–19  ·  view source on GitHub ↗
(values)

Source from the content-addressed store, hash-verified

12
13# Table maker
14def table(values):
15 first = values[0]
16 keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first))
17 widths = [max([len(str(v[k])) for v in values]) for k in keys]
18 string = ' | '.join(['{:<' + str(w) + '}' for w in widths])
19 return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values])
20
21
22# Generate only list dictionary

Callers 1

generate_tableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected