iode.Lists.__delitem__
- Lists.__delitem__(key)[source]
Remove the (subset of) IODE list(s) referenced by key from the Lists database.
- Parameters:
- key: str or list(str)
(list of) name(s) of the IODE list(s) to be removed. The list of names can be given as a string pattern (e.g. “A*;*_”).
Examples
>>> from iode import SAMPLE_DATA_DIR >>> from iode import lists >>> lists.load(f"{SAMPLE_DATA_DIR}/fun.lst") Loading .../fun.lst 17 objects loaded
>>> # a) delete one IODE list >>> lists.get_names("C*") ['COPY', 'COPY0', 'COPY1'] >>> del lists["COPY"] >>> lists.get_names("C*") ['COPY0', 'COPY1']
>>> # b) delete several lists at once using a pattern >>> del lists["C*"] >>> lists.get_names("C*") []
>>> # c) delete several lists at once using a list of names >>> lists.get_names("T*") ['TOTAL', 'TOTAL0', 'TOTAL1'] >>> del lists[["TOTAL", "TOTAL0"]] >>> lists.get_names("T*") ['TOTAL1']
>>> # delete one IODE list from a subset of the global database >>> lists_subset = lists["E*"] >>> lists_subset.names ['ENDO', 'ENDO0', 'ENDO1', 'ENVI'] >>> del lists_subset["ENVI"] >>> lists_subset.names ['ENDO', 'ENDO0', 'ENDO1'] >>> # NOTE: the IODE list has also been deleted from the global database >>> "ENVI" in lists False >>> lists.get_names("E*") ['ENDO', 'ENDO0', 'ENDO1']