I have loaded a YAML file (template) that I want to modify (keys and some values).
e.g.
key_to_rename:
a: "1"
b: "2"
c: "3"
How do I find & rename a key with PyYAML?
my_dict = yaml.load(stream)
for key, value in my_dict.iteritems():
if (key == "key_to_rename"):
print key
key = "new_name"
print key
print yaml.dump(my_dict)
but that's still not persisting the change