jinja2 - String concatenation in Jinja -


i want loop through existing list , make comma delimited string out of it.
this: my_string = 'stuff, stuff, stuff, stuff'

i know loop.last, need know how make third line in code below work.

{% set my_string = '' %} {% stuff in stuffs %} {% set my_string = my_string + stuff + ', '%} {% endfor%} 

if stuffs list of strings, work:

{{ stuffs|join(", ") }} 

link documentation.


Comments

Popular posts from this blog

List<T>().Add problem C# -

Javascript natural sort array/object and maintain index association -