python-tabulate
python-tabulate copied to clipboard
Sub headings would be a great feature
This is an excellent python utility. I'd use it a lot more if I could have sub headings. Here's an example:
I have this table:
| site | name | primary.database_host | primary.database_port | primary.host | primary.port | primary.state | primary.status | replica.database_host | replica.database_port | replica.host | replica.port | replica.state | replica.status |
|--------|--------|-------------------------|-------------------------|-----------------|----------------|-----------------|------------------|-------------------------|-------------------------|----------------|----------------|-----------------|------------------|
| Mars | S1 | Earth:localhost | 16001 | Earth:localhost | 6001 | promoted | running | Mars:remote1 | 22001 | Mars:remote1 | 12001 | demoted | running |
| Earth | S1 | Earth:localhost | 16001 | Earth:localhost | 6001 | promoted | running | Mars:remote1 | 22001 | Mars:remote1 | 12001 | demoted | running |
It takes up more room than it should. I'd like to pass my headings as e.g.
['site', 'name', ['primary', 'database_host', 'database_port', 'host', 'port', 'state', 'status'], ['replica', 'database_host', 'database_port', 'host', 'port', 'state', 'status']]
to get:
| site | name | primary | replica |
| | | database_host | database_port | host | port | state | status | database_host | database_port | host | port | state | status |
|-------|------|--------------- |---------------|-----------------|------|----------|---------|---------------|---------------|--------------|-------|---------|---------|
| Mars | S1 | Earth:localhost | 16001 | Earth:localhost | 6001 | promoted | running | Mars:remote1 | 22001 | Mars:remote1 | 12001 | demoted | running |
| Earth | S1 | Earth:localhost | 16001 | Earth:localhost | 6001 | promoted | running | Mars:remote1 | 22001 | Mars:remote1 | 12001 | demoted | running |