title: Split string into list in jinja?
body: <p>I have some variables in a jinja2 template which are strings seperated by a ';'.</p>
  
  <p>I need to use these strings separately in the code.
  i.e. the variable is variable1 = "green;blue"</p>
  
  <pre><code>{% list1 = {{ variable1 }}.split(';') %}
  The grass is {{ list1[0] }} and the boat is {{ list1[1] }}
  </code></pre>
  
  <p>I can split them up before rendering the template but since it are sometimes up to 10 strings inside the string this gets messy.</p>
  
  <p>I had a jsp before where I did:</p>
  
  <pre><code>&lt;% String[] list1 = val.get("variable1").split(";");%&gt;    
  The grass is &lt;%= list1[0] %&gt; and the boat is &lt;%= list1[1] %&gt;
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>It works with:</p>
  
  <pre><code>{% set list1 = variable1.split(';') %}
  The grass is {{ list1[0] }} and the boat is {{ list1[1] }}
  </code></pre>