I am new to YAML and have been searching for ways to parse a YAML file and use/access the data from the parsed YAML.
I have come across explanations on how to parse the YAML file, for example, the PyYAML tutorial, "How can I parse a YAML file in Python", "Convert Python dict to object?", but what I haven't found is a simple example on how to access the data from the parsed YAML file.
Assume I have a YAML file such as:
treeroot:
branch1: branch1 text
branch2: branch2 text
How do I access the text "branch1 text"?
"YAML parsing and Python?" provides a solution, but I had problems accessing the data from a more complex YAML file. And, I'm wondering if there is some standard way of accessing the data from a parsed YAML file, possibly something similar to "tree iteration" or "elementpath" notation or something which would be used when parsing an XML file?
See Question&Answers more detail:os