Lib para Python para processar YAML

Docs: https://pyyaml.org/wiki/PyYAMLDocumentation

Instalação

pip install pyyaml

Uso

from yaml import load, dump
try:
    from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
    from yaml import Loader, Dumper

Load:

data = load(stream, Loader=Loader)

Dump:

output = dump(data, Dumper=Dumper)