How can I modify/merge Jinja2 dictionaries?

前端 未结 3 1584
慢半拍i
慢半拍i 2020-12-10 02:53

I have a Jinja2 dictionary and I want a single expression that modifies it - either by changing its content, or merging with another dictionary.

>>>         


        
3条回答
  •  抹茶落季
    2020-12-10 03:22

    I found another solution without any extension.

    {% set _dummy = x.update({4:5}) %}
    

    It makes x updated. Don't use _dummy.

提交回复
热议问题