-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hi!
I'd love to have a "less verbose" fancy grid layout. this, for example, seems counter-intuitive:
#!/usr/bin/python3
import tabulate
table = [["spam",42],["eggs",451],["bacon",0]]
headers = ["item", "qty"]
print(tabulate.tabulate(table, headers, tablefmt="simple"))
print(tabulate.tabulate(table, headers, tablefmt="fancy_grid"))$ python3 ~/bin/test-tabulate.py
item qty
------ -----
spam 42
eggs 451
bacon 0
╒════════╤═══════╕
│ item │ qty │
╞════════╪═══════╡
│ spam │ 42 │
├────────┼───────┤
│ eggs │ 451 │
├────────┼───────┤
│ bacon │ 0 │
╘════════╧═══════╛
ie. why are there separators between the lines in the second table and not the first? it makes tables really (needlessly, IMHO) long. i would prefer it like this:
#!/usr/bin/python3
import tabulate
table = [["spam",42],["eggs",451],["bacon",0]]
headers = ["item", "qty"]
fancy_grid_nogap = tabulate.TableFormat(lineabove=tabulate.Line("╒", "═", "╤", "╕"),
linebelowheader=tabulate.Line("╞", "═", "╪", "╡"),
linebetweenrows=None,
linebelow=tabulate.Line("╘", "═", "╧", "╛"),
headerrow=tabulate.DataRow("│", "│", "│"),
datarow=tabulate.DataRow("│", "│", "│"),
padding=1, with_header_hide=None)
print(tabulate.tabulate(table, headers, tablefmt="simple"))
print(tabulate.tabulate(table, headers, tablefmt=fancy_grid_nogap))$ python3 ~/bin/test-tabulate.py
item qty
------ -----
spam 42
eggs 451
bacon 0
╒════════╤═══════╕
│ item │ qty │
╞════════╪═══════╡
│ spam │ 42 │
│ eggs │ 451 │
│ bacon │ 0 │
╘════════╧═══════╛
and while, yes, i found out I can do that myself, I was wondering if you would welcome a PR that would do so. :)
thanks!
Metadata
Metadata
Assignees
Labels
No labels