2 ms·
How about this? max_width = max(len(x) for y in table for x in y)) items = [] for row in table: rowstr = "".join( el + " " * (max_width
by otteromkram 2y ago
How about this?
max_width = max(len(x) for y in table for x in y))
items = []
for row in table:
rowstr = "".join(
el + " " * (max_width - len(el)) for el in row
)
items.append(rowstr)
# or, to print inline
#for el in row:
# print(item, end = " " * (max_width - len(el)))
#print()
print("\n".join(items))