If you want to parse/read a YAML file into a Python project and if your YAML file looks like this:
treeroot:
branch1:
name: Node 1
branch1-1:
name: Node 1-1
branch2:
name: Node 2
branch2-1:
name: Node 2-1
In that case, you will have to install PyYAML like as follows:-
pip install PyYAML
And the Python code looks like this:
import yaml
with open('tree.yaml') as f:
dataMap = yaml.safe_load(f)