YAML
Last updated
Was this helpful?
Last updated
Was this helpful?
“YAML Ain’t Markup Language” (abbreviated YAML) is a human-readable data serialization standard that can be used in conjunction with all programming languages and is often used to write configuration files. YAML is designed to be useful and friendly to people working with data. Its features are derived from Perl, C, HTML, and other languages. YAML is a superset of JSON that comes with multiple built-in advantages such as including comments, self-referencing, and support for complex data types. Full documentation for YAML can be found on its .
A YAML file is just a flat file value with key : value pairs. YAML supports strings, integers, floats, lists, and associative arrays.
The configuration data can be read by the yaml.safe_load()
function from the yaml
library.
The PyYAML module transforms the values into a Python dictionary. In your python code, you can use this python dictionary just like an ordinary dictionary.
with yaml.dump()
we can write to configuration files.
The example is derived from