iode.Table.__iadd__

Table.__iadd__()

Append a new line to the table.

Parameters:
value: str or list(str) or tuple(str) or TableLine or TableLineType

value of the new line. If TableLineType, ‘value’ represents the type of the new line: FILES, MODE, DATE or SEP. If str, ‘value’ represents either a separator line if it only contains characters ‘-’ or a title line. If an iterable of str, ‘value’ represents the content of the cells of the new line.

Examples

>>> from iode import SAMPLE_DATA_DIR, TableLineType
>>> from iode import Table, comments, lists, variables
>>> comments.load(f"{SAMPLE_DATA_DIR}/fun.cmt")
>>> lists.load(f"{SAMPLE_DATA_DIR}/fun.lst")
>>> variables.load(f"{SAMPLE_DATA_DIR}/fun.var")
>>> table_title = "Table example"
>>> lines_titles = ["GOSG:", "YSSG+COTRES:", "OCUG:"]
>>> lines_lecs = ["GOSG", "YSSG+COTRES", "OCUG"]
>>> table = Table(2, table_title, lines_lecs, lines_titles)
>>> table           
DIVIS | 1              |
TITLE |       "Table example"
----- | ----------------------------
CELL  |                |     "#S"
----- | ----------------------------
CELL  | "GOSG:"        |        GOSG
CELL  | "YSSG+COTRES:" | YSSG+COTRES
CELL  | "OCUG:"        |        OCUG

nb lines: 7
nb columns: 2
language: 'ENGLISH'
gridx: 'MAJOR'
gridy: 'MAJOR'
graph_axis: 'VALUES'
graph_alignment: 'LEFT'
>>> # append a separator line
>>> table += '-'
>>> # append a title
>>> table += "New Title"
>>> # append a separator line 
>>> table += TableLineType.SEP
>>> # append a line with cells
>>> # "    -> STRING cell
>>> # no " -> LEC cell
>>> table += ['"RIDG:"', 'RIDG']
>>> table           
DIVIS | 1              |
TITLE |       "Table example"
----- | ----------------------------
CELL  |                |     "#S"
----- | ----------------------------
CELL  | "GOSG:"        |        GOSG
CELL  | "YSSG+COTRES:" | YSSG+COTRES
CELL  | "OCUG:"        |        OCUG
----- | ----------------------------
TITLE |         "New Title"
----- | ----------------------------
CELL  | "RIDG:"        |        RIDG

nb lines: 11
nb columns: 2
language: 'ENGLISH'
gridx: 'MAJOR'
gridy: 'MAJOR'
graph_axis: 'VALUES'
graph_alignment: 'LEFT'