Python 3 pyyaml Library to Modify & Update YAML Files in Command Line



pip install pyyaml



If you care about preserving the order of your mapping keys, the comment and the white space between the elements of the root-level sequence, e.g. because this file is under revision control, then you should use ruamel.yaml (disclaimer: I am the author of that package).

Assuming your YAML document is in the file input.yaml:






Leave a Reply