toing_toing
toing_toing

Reputation: 2442

Split string into individual charactor array in jinja2

I need to convert a string acbdefrg into an array of individual letters [a,b,c,d,e,f,r,g]. I understand how it's done in python through list(your_string).

Hoever this code does not work in jinja2. Is this possible, or will I have to make the array in python and pass it over to jinja?

Upvotes: 0

Views: 736

Answers (1)

danieltan95
danieltan95

Reputation: 860

If you mean to just iterate through the string, you can explicitly make the array in python and pass it into jinja.

Try to minimise logic in jinja as much as possible.

Upvotes: 1

Related Questions