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

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -