Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I insert space in Jinja template for loop?

I populate textarea with

textarea.value='{%for i in range(0,3)%}{{data[i][0]}}{% endfor %}'.

But It produces string without spaces in between i so the output is like firstsecondthird. I'd like it to be first second third.

What are the ways to do it?


1 Answers

You need to do it outside the calculation part:

textarea.value='{%for i in range(0,3)%}{{data[i][0]}} {% endfor %}'

Notice the space after {{data[i][0]}}

like image 57
Ahmed Amr Avatar answered Mar 27 '26 14:03

Ahmed Amr