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
  • 158,662
  • 42
  • 215
  • 303
Anoop P Alias
  • 373
  • 1
  • 6
  • 15

0 Answers0