Jun-12-2020, 10:20 AM
Hi,
I have a nested dictionary output from aws service from which I need to extract the cluster name and it's corresponding ID. I am storing cluster name as key in a dictionary. I want to include ID as value to the key which is cluster_name in this case.
I have a nested dictionary output from aws service from which I need to extract the cluster name and it's corresponding ID. I am storing cluster name as key in a dictionary. I want to include ID as value to the key which is cluster_name in this case.
cluster_name = {} for cluster in cluster['ClusterInfoList']: cluster_name[cluster['ClusterName']] =[] break kb = [] for broker in kfk_broker['NodeInfoList']: kb = broker['BrokerNodeInfo']['BrokerId']
Output:cluster_name output
{'cluster1': [], 'cluster2':[]}
kb output
1
2
3
I would like to assign the value of kb as value to the dictionary for clusternameOutput:Desired output
{'cluster1': [1,2,3], 'cluster2':[1,2,3]}
Thanks in advance for the help