I understand the difference between an array and dictionary, say in python - especially when it comes to accessing content in both.
But in YAML, I kinda find it difficult to differentiate between the two especially when it comes to writing structures. Please How do they differ in their definitions?
# YAML sequences (aka Python lists)
# option 1: block style
departments:
- marketing
- sales
- security
# option 2: flow style
departments: [marketing, sales, security]
# YAML dictionary
marketing:
team-size: 20
location: nyc
# expanding the sequence to include dictionaries
departments:
- marketing:
team-size: 20
location: nyc
- sales:
team-size: 30
location: sf
- security:
team-size: 10
location: mia
Given your familiarity with Python, I'll focus more on syntax:
- name: To clarify with an example: option 1 above shows a block style sequence. This is denoted with the spacing + -. We can convert each element, or value, in that mapping to a scalar by creating further indentations without the - (see #expanding the sequence)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With