Feb-09-2022, 08:26 AM
Hello ,
I am trying to update values in in dict that construct from nested dict and list the dict as follows
Thanks
I am trying to update values in in dict that construct from nested dict and list the dict as follows
dict_file ={'job_name': 'system', 'static_configs': [{'targets': ['localhost'], 'labels': {'job': 'varlogs', '__path__': '/var/log/*log', 'host': 'grafana'}}]}I can get the values of the desired keys as shown below but don't know how to update them
job_name = dict_file.get('job_name') host_name = dict_file.get('static_configs')[0].get('labels').get('host') path_name = dict_file.get('static_configs')[0].get('labels').get('__path__')Please advice
Thanks