I have two lists of rows, each with two rows, like this:
list1 = [{'a': 'foo', 'b': 'bar', 'c': 'baz'}, {'d': 'qux', 'e': 'quux', 'f': 'quuz'}]
list2 = [{'g': 'corge', 'h': 'grault', 'i': 'garply'}, {'j': 'waldo', 'k': 'fred', 'l': 'plugh'}]
I would like to join the two lists so that row 1 from list 1 is joined with row 1 from list 2 and row 2 from list 1 is joined with row 2 from list 2, like this:
final_list = [{'a': foo, 'b': bar 'c': baz, 'g': corge, 'h': grault, 'i': garply}, {'d': qux, 'e': quux, 'f': quuz, 'j': waldo, 'k': fred, 'l': plugh}]
I have tried:
final_list = [[i, j] for i,j in zip(list1, list2)]
But it doesn't quite join them correctly. Instead, it produces:
[{'a': foo, 'b': bar 'c': baz}, {'g': corge, 'h': grault, 'i': garply}], [{'d': qux, 'e': quux, 'f': quuz}, {'j': waldo, 'k': fred, 'l': plugh}]
I would like to join these lists of rows so that I can then loop through them with Jinja on an HTML page. How can I resolve this issue?