iode.Table.__delitem__
- Table.__delitem__(index: int)[source]
Delete the line at the given index
- Parameters:
- index: int
index of the line to be removed.
Examples
>>> from iode import SAMPLE_DATA_DIR >>> 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, True, True, True) >>> table DIVIS | 1 | TITLE | "Table example" ----- | ---------------------------- CELL | | "#S" ----- | ---------------------------- CELL | "GOSG:" | GOSG CELL | "YSSG+COTRES:" | YSSG+COTRES CELL | "OCUG:" | OCUG ----- | ---------------------------- MODE | FILES | DATE | nb lines: 11 nb columns: 2 language: 'ENGLISH' gridx: 'MAJOR' gridy: 'MAJOR' graph_axis: 'VALUES' graph_alignment: 'LEFT'
>>> # remove the MODE line >>> del table[-3] >>> table DIVIS | 1 | TITLE | "Table example" ----- | ---------------------------- CELL | | "#S" ----- | ---------------------------- CELL | "GOSG:" | GOSG CELL | "YSSG+COTRES:" | YSSG+COTRES CELL | "OCUG:" | OCUG ----- | ---------------------------- FILES | DATE | nb lines: 10 nb columns: 2 language: 'ENGLISH' gridx: 'MAJOR' gridy: 'MAJOR' graph_axis: 'VALUES' graph_alignment: 'LEFT'