iode.Table.__iadd__

Table.__iadd__(value: str | List[str] | Tuple[str] | TableLineType | TableLine) Self[source]

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")
Loading .../fun.cmt
317 objects loaded 
>>> lists.load(f"{SAMPLE_DATA_DIR}/fun.lst")
Loading .../fun.lst
17 objects loaded 
>>> variables.load(f"{SAMPLE_DATA_DIR}/fun.var")
Loading .../fun.var
394 objects loaded
>>> 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
>>> # NOTE: line containing double quotes " -> assumed to be a STRING cell
>>> #       line without double quotes      -> assumed to be a 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'