In Python, how can you load YAML mappings as OrderedDicts?
I’d like to get PyYAML‘s loader to load mappings (and ordered mappings) into the Python 2.7+ OrderedDict type, instead of the vanilla dict and the list of pairs it currently uses.
I’d like to get PyYAML‘s loader to load mappings (and ordered mappings) into the Python 2.7+ OrderedDict type, instead of the vanilla dict and the list of pairs it currently uses.
I have a Python program that uses YAML. I attempted to install it on a new server using pip install yaml and it returns the following:
I’m using yaml.dump to output a dict. It prints out each item in alphabetical order based on the key.
I’ve got an object with a short string attribute, and a long multi-line string attribute. I want to write the short string as a YAML quoted scalar, and the multi-line string as a literal scalar: