How do I convert an array to string using the jinja template engine?
You can use regular python in jinja tags. an obvious choice for some simple cases is str.join
:
>>> jinja2.Template(r'{{ " ".join(bar) }}').render(bar='baz')
u'b a z'.
You can also iterate over sequences in jinja with a for
block:
>>> jinja2.Template(r'{% for quux in bar %}{{ quux }} {% endfor %}').render(bar='baz')
u'b a z '
Actually you are almost there, for join with space, just put it like this:
{{ tags|join(' ') }}
see the jinja docs for more details