4

I am trying to write a dictionary value to a YAML file.

The dict is:

data_dict = {'BACKENDTYPE' :{ 'BACKENDNAME' : 'BACKENDPATH'}}

The update code is:

with open(backend_config_file,'w')as yaml_file:
            yaml_file.write(yaml.dump(data_dict , default_flow_style=False))

The problem is that it will always overwrite the YAML file and not append the dictionary.

Is there a way to append the data or should the data be manipulated as the dict itself and the resulting dictionary saved entirely?

the Tin Man
  • 155,156
  • 41
  • 207
  • 295
Anoop P Alias
  • 343
  • 5
  • 14

0 Answers0