I am trying to print a 2d matrix with dynamic values. Basically I would like something that looks like this:
---------------------------------------------
| Column 1 | Column 2 | Column 3 | Column 4 |
---------------------------------------------
| A        | A_2      | A_3      | A_4      |
| B        | B_2      | B_3      | B_4      |
| C        | C_2      | C_3      | C_4      |
---------------------------------------------
With A_2, A_3... being dynamic (updating constantly). The print method is maybe not the best solution, thus any other idea to generate this kind of table in a relative fast way is welcomed.
I thought I could build a class to be very general. Something like this:
class Viewer:
    def __init__(self, header_columns):
        # start building the viewer
    def update_row(self, data_row):
        # add the row if it does not exist
        # else, update the row with new values
        # and update the table printed
def main():
    header = ['id', 'value1', 'value2']
    myview = Viewer(header)
    # start updating the values
    for i in range(10):
        firstid = {'id': 'A', 'value1': i, 'value2': i}
        myview.update_row(firstid)
To be even more general, the column headers could be updated with the Keys of the rows objects.
However, I do not understand how I can do that. I read I could use the library Curses (I use Mac OS), but I'm really not sure if it can do the job