Simple Objects in Data Tables

in python > 3.5 when you iterate over a dictionary with a for loop you end up with the keys, so something like:

so like in other languages:

contractor_data[contractor_data_key][key2] = new_val2

would be how you update a value in something nested.

off topic, but python can be more explicit (for legibility) and this also works:

contractor_data[contractor_data_key].update( { key2: new_val2 } )

With the above you can update multiple entries at once by making that update dictionary any arbitrary length of keys and data. Duplicate keys will overwrite, and new ones will be created.

1 Like