[Solved] Updating a Dictionary within Python


Not sure if I got your goal correctly but based on the examples you gave the following approach might work.

CC = {}

for step in range(len(Nodes['time'])):
    for key in CoordComboSort.keys():
        CC[Nodes['time'][step]] = {key : CoordComboSort[key][step] for key in CoordComboSort.keys()}

For your input, the output will be like this:

{'A': {0: (1, 4, 5), 0.001: (4, 6, 8)}, 'B': {0: (1, 7, 4), 0.001: (3, 8, 6)}}

1

solved Updating a Dictionary within Python