grid (complex)ΒΆ
These python commands:
1import pyRestTable
2t = pyRestTable.Table()
3t.labels = ('one', 'two', 'three' )
4t.rows.append( ['1,1', '1,2', '1,3',] )
5t.rows.append( ['2,1', '2,2', '2,3',] )
6t.rows.append( ['3,1', '3,2', '3,3',] )
7t.rows.append( ['4,1', '4,2', '4,3',] )
8print(t.reST(fmt='grid'))
build this table in reST source code:
1+-----+-----+-------+
2| one | two | three |
3+=====+=====+=======+
4| 1,1 | 1,2 | 1,3 |
5+-----+-----+-------+
6| 2,1 | 2,2 | 2,3 |
7+-----+-----+-------+
8| 3,1 | 3,2 | 3,3 |
9+-----+-----+-------+
10| 4,1 | 4,2 | 4,3 |
11+-----+-----+-------+
which is rendered as:
one |
two |
three |
---|---|---|
1,1 |
1,2 |
1,3 |
2,1 |
2,2 |
2,3 |
3,1 |
3,2 |
3,3 |
4,1 |
4,2 |
4,3 |
Note
API Changes
version 2015.1111.01
In versions previous to 2015.1111.01, the
complex
output table format was supported:print t.reST(fmt='complex')
The
complex
output format has been aliasedgrid
to be consistent with the docutils [1] documentation:print(t.reST(fmt='grid'))
The two commands are identical (except the latter is upgraded for compatibility with Python v3). To preserve existing code, no plans are made to deprecate the
complex
name.