Bootstrap FreeKB - Jinja - Append values to a variable in a loop
Jinja - Append values to a variable in a loop

Updated:   |  Jinja articles

Let's say the items list contains the following.

  • item[0] = John
  • item[1] = Doe

Here is how you could create a variable named name that contains John Doe.

{% for item in items %}
{% set name = item[0] %}
{% set name = name + " " + item1[1] %}
{% endfor %}

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 47a8a1 in the box below so that we can be sure you are a human.