Is there a way to define the format style (number of decimals) for the Python module tabulate
?
For example:
I have the number 3.34643745.
I want to format the number of decimals to print out only two decimal places.
Output: 3.34
Yes you can do something like:
print tabulate([["pi",3.141593],["e",2.718282]], floatfmt=".2f")
Which will print:
-- ----
pi 3.14
e 2.71
-- ----
Here is a link to the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With