How do I break a string in YAML over multiple lines?

Using yaml folded style. The indention in each line will be ignored. A line break will be inserted at the end. http://symfony.com/doc/current/components/yaml/yaml_format.html You can use the “block chomping indicator” to eliminate the trailing line break, as follows: In either case, each line break is replaced by a space. There are other control tools available as … Read more

How do you do block comments in YAML?

YAML supports inline comments, but does not support block comments. From Wikipedia: Comments begin with the number sign ( # ), can start anywhere on a line, and continue until the end of the line A comparison with JSON, also from Wikipedia: The syntax differences are subtle and seldom arise in practice: JSON allows extended … Read more

How can I parse a YAML file in Python

The easiest and purest method without relying on C headers is PyYaml (documentation), which can be installed via pip install pyyaml: And that’s it. A plain yaml.load() function also exists, but yaml.safe_load() should always be preferred unless you explicitly need the arbitrary object serialization/deserialization provided in order to avoid introducing the possibility for arbitrary code execution. Note the PyYaml project … Read more