YAML syntax for Salt and Python -


what diference between this:

dic1:    - subdict1.1: value11.1   - subdict1.2: value1.2   - cubdict1.3: value1.3 

and this:

dict2:   subdict2.1: value2.2   subdict2.1: value2.2   subdict2.3: value2.3 

i know first 1 evaluates list of dictionaries. second one? isn't list of dictionaries?

no, nested dictionary.

example

yaml code:

first_level_dict_key:   second_level_dict_key: value_in_second_level_dict 

results in python:

{     'first_level_dict_key': {         'second_level_dict_key': 'value_in_second_level_dict'     } } 

explanation salt docs.

rule two: colons

python dictionaries are, of course, key-value pairs. users other languages may recognize data type hashes or associative arrays.

dictionary keys represented in yaml strings terminated trailing colon. values represented either string following colon, separated space


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -