def columnise(rows, padding=<NUM_LIT:2>):
strs = []<EOL>maxwidths = {}<EOL>for row in rows:<EOL><INDENT>for i, e in enumerate(row):<EOL><INDENT>se = str(e)<EOL>nse = len(se)<EOL>w = maxwidths.get(i, -<NUM_LIT:1>)<EOL>if nse > w:<EOL><INDENT>maxwidths[i] = nse<EOL><DEDENT><DEDENT><DEDENT>for row in rows:<EOL><INDENT>s = '<STR_LIT>'<EOL>for i, e in enumerate(row):<EOL><INDENT>se = str(e)<EOL>if i < len(row) - <NUM_LIT:1>:<EOL><INDENT>n = maxwidths[i] + padding - len(se)<EOL>se += '<STR_LIT:U+0020>' * n<EOL><DEDENT>s += se<EOL><DEDENT>strs.append(s)<EOL><DEDENT>return strs<EOL>
Print rows of entries in aligned columns.