title: How to output a comma delimited list in jinja python template?
body: <p>If I have a list of <code>users</code> say <code>["Sam", "Bob", "Joe"]</code>, I want to do something where I can output in my jinja template file:</p>
  
  <pre><code>{% for user in userlist %}
      &lt;a href="/profile/{{ user }}/"&gt;{{ user }}&lt;/a&gt;
      {% if !loop.last %}
          , 
      {% endif %}
  {% endfor %}   
  </code></pre>
  
  <p>I want to make the output template be:</p>
  
  <pre><code>Sam, Bob, Joe
  </code></pre>
  
  <p>I tried the above code to check if it was on the last iteration of the loop and if not, then don't insert a comma, but it does not work. How do I do this?</p>