yodl Use PyYAML to load a document into a Python OrderedDict. import yaml import yodl data = yaml.load(input, yodl.OrderedDictYAMLLoader) Installing yodl is available on PyPI.