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 (https://pypi.python.org/pypi/clg) 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: http://stackoverflow.com/questions/5121931/in-python-how-can-you-load-yaml-mappings-as-ordereddicts
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
Close
Hashes for yamlordereddictloader-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4f0d1b6c0d56ce83accef3c228b2eb060d3d5d45238d37365af9268ce4e65ed |
|
MD5 | 68a163f84cc81064fe01e41ce12025fd |
|
BLAKE2b-256 | 954419b8fb5c71c07c1ba8e1f69b4c5e8a1108acf6cd6502c5966a300c60cf6c |