Bootstrap FreeKB - Jinja - Convert string to list using split
Jinja - Convert string to list using split

Updated:   |  Jinja articles

split can be used to convert a string into a list.

{% set fruit='apple','banana','grape','orange' %}
{% set fruits.split(',') %}
{% for item in fruits %}
{{ item  }}
{% 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 e15344 in the box below so that we can be sure you are a human.