I need to print table with leading spaces in some rows data (like execution plan from postgres),
the only way I found is to use stralign=None , but it breaks the table completely for most formats
from tabulate import tabulate
print(tabulate([[" foo"], ["bar"]], stralign=None, tablefmt="pretty"))
+---------+
| foo |
| bar |
+---------+
Workaround-like is to use default stralign and replace leading spaces with something printable (any non-visible chars are stripped), so actually there is no workaround.
I need to print table with leading spaces in some rows data (like execution plan from postgres), the only way I found is to use
stralign=None
, but it breaks the table completely for most formatsWorkaround-like is to use default stralign and replace leading spaces with something printable (any non-visible chars are stripped), so actually there is no workaround.