list-tableΒΆ
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='list-table'))
build this table source code:
1.. list-table::
2 :header-rows: 1
3 :widths: 3 3 5
4
5 * - one
6 - two
7 - three
8 * - 1,1
9 - 1,2
10 - 1,3
11 * - 2,1
12 - 2,2
13 - 2,3
14 * - 3,1
15 - 3,2
16 - 3,3
17 * - 4,1
18 - 4,2
19 - 4,3
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 |