python-tabulate icon indicating copy to clipboard operation
python-tabulate copied to clipboard

Header on the left

Open isidroas opened this issue 2 years ago • 1 comments

For example:

from codecs import encode
from string import ascii_uppercase

rot13_cipher = [(c, encode(c,'rot13')) for c in ascii_uppercase]
tabulate(rot13_cipher, headers = ('input', 'output'), header_pos='left')

resulting in

+--------++---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| input  || A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
+--------++---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| output || N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L | M |
+--------++---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

The use case is for small tables. It can save more space in the screen/page using horizontal columns.

isidroas avatar Jun 17 '23 11:06 isidroas

Related to https://github.com/astanin/python-tabulate/issues/237

isidroas avatar Jun 17 '23 11:06 isidroas