|
|
@ -230,7 +230,7 @@ These example produces ``{"a": "b", "c": "d"}``
|
|
|
|
|
|
|
|
|
|
|
|
vars:
|
|
|
|
vars:
|
|
|
|
single_list: [ 'a', 'b', 'c', 'd' ]
|
|
|
|
single_list: [ 'a', 'b', 'c', 'd' ]
|
|
|
|
mydict: "{{ dict(single_list | slice(2) | list) }}"
|
|
|
|
mydict: "{{ dict(single_list | slice(2)) }}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. code-block:: YAML+Jinja
|
|
|
|
.. code-block:: YAML+Jinja
|
|
|
@ -240,7 +240,7 @@ These example produces ``{"a": "b", "c": "d"}``
|
|
|
|
list_of_pairs: [ ['a', 'b'], ['c', 'd'] ]
|
|
|
|
list_of_pairs: [ ['a', 'b'], ['c', 'd'] ]
|
|
|
|
mydict: "{{ dict(list_of_pairs) }}"
|
|
|
|
mydict: "{{ dict(list_of_pairs) }}"
|
|
|
|
|
|
|
|
|
|
|
|
Both end up being the same thing, with the ``slice(2) | list`` transforming ``single_list`` to the same structure as ``list_of_pairs``.
|
|
|
|
Both end up being the same thing, with ``slice(2)`` transforming ``single_list`` to a ``list_of_pairs`` generator.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|