I want to find an approach to print list as tabular table. There is many library help me to do that. But when the size of list is too long, it’s not convenient to view results.
root@debian:~# print.py
name | score
-----+------
Tim | 99
Ana | 80
Jim | 100
Tim | 100
Tom | 150
... long outputs ...
Lily | 100
Lucy | 120
If we can take advantage of screen width, with duplicate table on the right to reduce table length.
It’s better to print as:
name | score name | score name | score
-----+------ -----+------ -----+------
Tom | 100 Jim | 100 Tim | 99
Ana | 80 Lily | 99
Can any lib do that?
2
Answers
Resolved by the code below:
I don’t know of any libraries that do that but you can force to print in 3 columns just with indexing and formatted strings. Very ugly solution though:
And this is the output: