I have a program which prints random value from a list in the cells of a table using python docx. The number of tables, cells and rows depend on user input. I need to compare cells of tables before inputing value in the same number cell in another table.
For example.
number_of_tables = 5 #input by user number_of_rows = 4 #input by user number_of_cols = 7 #input by user list = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] docu = Document() for tablenum in range(number_of_tables): tablename = docu.add_table(rows = number_of_rows, cols = number_of_cols) for rowiteration in tablename.rows[0:]: for cells in rowiteration.cells: cells.text = random.choices(list) If here cell(0,0) in table 1 has 'a' I don't want to print in 'a' in cell(0,0) of table 2 and further more.