I have a dictionary that prints well
print(
"""{ASSET_EDGE_CONFIG[EndAdvertiserAdAccounts][hive_data_features][rev_28d]}""".format(**locals())
)
But I want to parametrize 'EndAdvertiserAdAccounts' key to something like below
EDGE = 'EndAdvertiserAdAccounts'
print(
"""{ASSET_EDGE_CONFIG[{EDGE}][hive_data_features][rev_28d]}""".format(**locals())
)
above code gives me following error:
KeyError: '{EDGE}'
I guessing there is a particular way to formatting dict using format function. Any help is appreciated here
locals? Is there something in your use case which could not be achieved instead by computing the value first and then printing it? That would be a more typical approach.