I'm pretty new to PyYAML and don't understand everything about it. I have a YAML file with a list;
the-list:
- "string1"
- "string2"
- "string3"
I have managed to find out how to fetch the list in my python file, but not how to add another string on to it, and save it to the YAML file. So it would become
the-list:
- "string1"
- "string2"
- "string3"
- "newstring"
Help appreciated! Here's the code I use for reading the YAML file:
with open('config.yml', 'r') as f:
config = yaml.load(f)
LIST = config["the-list"]