astanin / python-tabulate

Pretty-print tabular data in Python, a library and a command-line utility. Repository migrated from bitbucket.org/astanin/python-tabulate.
https://pypi.org/project/tabulate/
MIT License
2.1k stars 163 forks source link

adds new colwidth arg allowing fixed width cols #262

Open cabutchei opened 1 year ago

cabutchei commented 1 year ago

This new argument in the tabulate function could be very useful for printing tables with consistent width. Since the program seems to ignore maxcolwidths whenever there are numeric strings of larger length than its value, I found it reasonable to be consistent with this and set colwidth to match the length of the longest numeric string whenever it happens to be shorter than it value. This preserves both the original behavior of the program and the width consistency across columns.