Skip to main content

YAML loader for PyYAML that allow to keep keys order.

Project description

This is a loader for PyYAML allowing to keep items order when loading a file. In some rare cases, it may be desired to keep the order of items when loading the YAML file. For example, this is the case of the clg module ( that generate a command-line from a dictionnary. When a YAML file is used, and in a purely esthetic purpose, it could be nice to keep order of the items.

The loader is based on stackoverflow topic:

To install it

$ pip install yamlordereddictloader

To use it

import yaml
import yamlordereddictloader

datas = yaml.load(open('myfile.yml'), Loader=yamlordereddictloader.Loader)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yamlordereddictloader-0.1.1.tar.gz (1.9 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page