ExportYAML

Export an expression as a YAML file.

ResourceFunction["ExportYAML"][session,assoc,file]

export assoc to a YAML file using a Python session.

Details and Options

Requires the PyYAML package (pip install PyYAML) on your machine.

Examples

Basic Examples

Start a Python session:

In[1]:=
session = StartExternalSession["Python"];

Export an association as a YAML file:

In[2]:=
ResourceFunction[ "https://www.wolframcloud.com/objects/user-7053ce31-817f-4643-aec1-\
eda27051bba6/DeployedResources/Function/ExportYAML"][session, <| "scalar" -> 5, "alias" -> 5, "sequence" -> {1, 2, 3}, "mapping" -> {<|1 -> "one"|>, <|2 -> "two"|>, <|3 -> "three"|>}|>, "C:\\Users\\arnoudb.WRI\\out.yaml"]

Print the resulting file for visual inspection:

In[3]:=
FilePrint["C:\\Users\\arnoudb.WRI\\out.yaml"]

Publisher Information