Closed watermelon0guy closed 2 months ago
Use float_format
float_format
It works
It not work
import prettytable as pt arr = [1.3310884083630156e-05, 6.655442041815078e-06, 5.546201701512565e-06] table = pt.PrettyTable() table.float_format = "0.8" table.add_row(arr) print(table)
+------------------------+-----------------------+-----------------------+ | Field 1 | Field 2 | Field 3 | +------------------------+-----------------------+-----------------------+ | 1.3310884083630156e-05 | 6.655442041815078e-06 | 5.546201701512565e-06 | +------------------------+-----------------------+-----------------------+
(Duplicate of https://github.com/jazzband/prettytable/issues/300)
What did you do?
Use
float_format
What did you expect to happen?
It works
What actually happened?
It not work
What versions are you using?