Function Repository Resource:

ImportYAML

Source Notebook

Import a YAML file

Contributed by: Arnoud Buzing

ResourceFunction["ImportYAML"][session,file]

imports a YAML file using an external Python session.

Details and Options

YAML refers to YAML Ain't Markup Language and is a human-friendly data serialization standard for all programming languages.
ResourceFunction["ImportYAML"] requires the PyYAML package to be installed on your machine. This package can be installed by running the command pip install PyYAML.

Examples

Basic Examples (2) 

Install PyYAML, if it is not already installed:

In[1]:=
RunProcess[{"pip", "install", "PyYAML"}, "StandardOutput"]
Out[1]=

Import a YAML file:

In[2]:=
session = StartExternalSession["Python"];
ResourceFunction["ImportYAML"][session, "document.yaml"]
Out[2]=

Display the raw content of the file:

In[3]:=
FilePrint["document.yaml"]

Publisher

Arnoud Buzing

Version History

  • 1.0.0 – 10 July 2019

Related Resources

License Information