Ejemplo n.º 1
0
def update(table, id_, record):
    """
    Updates specified record in the table.

    Args:
        table: list in which record should be updated
        id_ (str): id of a record to update
        record (list): updated record

    Returns:
        list: table with updated record
    """

    common.remove(table, id_)
    table = add(table, record)

    return table
def delete_record(table, id, filename):
    s = "".join(id)
    counter = 0
    remove_id = None
    for item in table:
        if str(item[0]) in str(s):
            remove_id = counter
            new_list = common.remove(table, remove_id)
        counter += 1
    data_manager.write_table_to_file(filename, new_list)
Ejemplo n.º 3
0
def remove(table, id_):
    """
    Remove a record with a given id from the table.

    Args:
        table (list): table to remove a record from
        id_ (str): id of a record to be removed

    Returns:
        list: Table without specified record.
    """
    return common.remove(table, id_)
Ejemplo n.º 4
0
def remove(table, id_):
    table = common.remove(table, id_)
    return table
def remove(file):
    get_table_from(file)
    id_ = terminal_view.get_input(
        "ID: ", "Please provide ID, which you want to remove")
    save(file, common.remove(get_table_from(file), id_))