Basic Examples (2)
Basic Examples
(2)
Install PyYAML, if it is not already installed:
In[1]:=
RunProcess[{"pip","install","PyYAML"},"StandardOutput"]
Out[1]=
Requirement already satisfied: PyYAML in c:\users\arnoudb.wri\appdata\local\programs\python\python36\lib\site-packages (5.1)
———
Import a YAML file:
In[1]:=
session=StartExternalSession["Python"];[session,"document.yaml"]
Out[1]=
scalar5,alias5,sequence{1,2,3},mapping{1one,2two,3three}
Display the raw content of the file:
In[2]:=
FilePrint["document.yaml"]
scalar: &A !!int '5'
alias: *A
sequence: [1, 2, 3]
mapping: [1: one, 2: two, 3: three]
alias: *A
sequence: [1, 2, 3]
mapping: [1: one, 2: two, 3: three]