Adding data to a YAML file using Python
I am trying to write a dictionary value to a YAML file.
The dictate is:
data_dict = {'BACKENDTYPE' :{ 'BACKENDNAME' : 'BACKENDPATH'}}
Update code:
with open(backend_config_file,'w')as yaml_file:
yaml_file.write(yaml.dump(data_dict , default_flow_style=False))
The problem is it will always overwrite the YAML file and not add the dictionary.
Is there a way to add the data or the data should be treated like the dict itself and the resulting dictionary, fully preserved?
+3
source to share
No one has answered this question yet
See similar questions:
or similar: