Step by step:
Create python 3 vitrtualenv
mkvirtualenv -p python3 testyaml
Install pyaml inside virtualenv
pip install pyaml
Now create some yaml file (example from https://en.wikipedia.org/wiki/YAML#Examples):
receipt: Oz-Ware Purchase Invoice date: 2012-08-06 customer: given: Dorothy family: Gale items: - part_no: A4786 descrip: Water Bucket (Filled) price: 1.47 quantity: 4 - part_no: E1628 descrip: High Heeled "Ruby" Slippers size: 8 price: 100.27 quantity: 1 bill-to: &id001 street: | 123 Tornado Alley Suite 16 city: East Centerville state: KS ship-to: *id001 specialDelivery: > Follow the Yellow Brick Road to the Emerald City. Pay no attention to the man behind the curtain.
And python script
import yaml d = yaml.load(open('foo.yaml')) print(d.keys()) print(d.values())
Run script
python3 foo.py
Check results