I want to read and write to several yaml files without changing the entire format of the file. When I use yaml.load
and yaml.dump
the format is entirely changed, resulting in many changed lines.
I only want to insert a key into several dictionaries that are missing the key. I also looked into using ruamel.yaml but it does not preserve format according to this answer: https://stackoverflow.com/a/54278583/4044470