I am appending items to a list:
from ruamel.yaml import YAML
yaml = YAML()
yaml.preserve_quotes = True
yaml.allow_duplicate_keys = True
formatted_yaml = yaml.load(Path(my_file).open().read())
for item in my_items:
# Just want a blank line here
formatted_yaml.append(None)
# Before adding this item
formatted_yaml.append(item)
This produces:
- blah: 'sdfsdf'
sdfsd: ''
-
- blah: 'sdfsdf'
sdfsd: ''
-
- blah: 'sdfsdf'
sdfsd: ''
-
etc..
The output I want though is this:
- blah: 'sdfsdf'
sdfsd: ''
- blah: 'sdfsdf'
sdfsd: ''
- blah: 'sdfsdf'
sdfsd: ''
etc..
Is it possible to just add an empty line like this?