pyRestTable

author:Pete R. Jemian
version:2017.2.0+0.ga7f8967.dirty
release:2017.2.0+0.ga7f8967.dirty<2017-02-15T10:04:33-0600>
published:February 15, 2017

source code documentation

Format a nice table in reST (restructured text)

User Interface Description
Table Construct a table in reST
addLabel() add label for one additional column
addRow() add list of items for one additional row
setLongtable() set longtable attribute
setTabularColumns() set use_tabular_columns & alignment attributes
reST() render the table in reST format
class pyRestTable.rest_table.Table[source]

Construct a table in reST (no row or column spans).

Parameters:
addLabel(text)[source]

add label for one additional column

Parameters:text (str) – column label text
Return int:number of labels
addRow(list_of_items)[source]

add list of items for one additional row

Parameters:list_of_items ([obj]) – list of items for one complete row
Return int:number of rows
find_widths()[source]

measure the maximum width of each column, considering possible line breaks in each cell

grid_table(indentation='')[source]

render the table in grid reST format

list_table(indentation='')[source]

render the table in list-table reST format:

See:http://docutils.sourceforge.net/docs/ref/rst/directives.html
Frozen Delights!
Treat Quantity Description
Albatross 2.99 On a stick!
Crunchy Frog 1.49 If we took the bones out, it wouldn’t be crunchy, now would it?
Gannet Ripple 1.99 On a stick!
plain_table(indentation='')[source]

render the table in plain reST format

reST(indentation='', fmt='simple')[source]

render the table in reST format

setLongtable(state=True)[source]

set longtable attribute

Parameters:longtable (bool) – True | False
setTabularColumns(state=True, column_spec=[])[source]

set use_tabular_columns & alignment attributes

Parameters:
  • state (bool) – True | False
  • column_spec ([str]) – list of column specifications
simple_table(indentation='')[source]

render the table in simple reST format

pyRestTable.rest_table.example_basic()[source]

basic example table

pyRestTable.rest_table.example_complicated()[source]

complicated example table

pyRestTable.rest_table.example_minimal()[source]

minimal example table