You are not logged in.

#1 2012-10-27 06:01:34

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 5,728
Website

Tabulator: format tables with Python

Project page: http://xyne.archlinux.ca/projects/python3-tabulator/

I've been using this module for ages now but have only now got around to releasing it. It makes it dead-simple to print nicely formatted tables in plaintext and other formats, and I'll add gradually.

If you ever find yourself iterating lists to find the longest member in order to correctly format the column, then this is for you.

There's a simple example on the project page to you get started. Just ask if anything is unclear.

Part of a larger table as an example:

                         Quantity                                Value         Uncertainty      Unit     
--------------------------------------------------------- -------------------- ----------- --------------
{220} lattice spacing of silicon                           1.920155714e-10       3.2e-18   m             
alpha particle-electron mass ratio                         7.2942995361e+3       2.9e-6                  
alpha particle mass                                        6.64465675e-27        2.9e-34   kg            
alpha particle mass energy equivalent                      5.97191967e-10        2.6e-17   J             
alpha particle mass energy equivalent in MeV               3.727379240e+3        8.2e-5    MeV           
alpha particle mass in u                                   4.001506179125e+0     6.2e-11   u             
alpha particle molar mass                                  4.001506179125e-3     6.2e-14   kg mol^-1     
alpha particle-proton mass ratio                           3.97259968933e+0      3.6e-10                 
Angstrom star                                              1.00001495e-10        9.0e-17   m             
atomic mass constant                                       1.660538921e-27       7.3e-35   kg            
atomic mass constant energy equivalent                     1.492417954e-10       6.6e-18   J             
atomic mass constant energy equivalent in MeV              9.31494061e+2         2.1e-5    MeV           
atomic mass unit-electron volt relationship                9.31494061e+8         2.1e+1    eV            
atomic mass unit-hartree relationship                      3.4231776845e+7       2.4e-2    E_h           
atomic mass unit-hertz relationship                        2.2523427168e+23      1.6e+14   Hz            
atomic mass unit-inverse meter relationship                7.5130066042e+14      5.3e+5    m^-1          
atomic mass unit-joule relationship                        1.492417954e-10       6.6e-18   J             
atomic mass unit-kelvin relationship                       1.08095408e+13        9.8e+6    K             
atomic mass unit-kilogram relationship                     1.660538921e-27       7.3e-35   kg         

Offline

Board footer

Powered by FluxBB