Skip to content

Instantly share code, notes, and snippets.

@seanislegend
Created April 16, 2014 09:29
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save seanislegend/10840829 to your computer and use it in GitHub Desktop.
Save seanislegend/10840829 to your computer and use it in GitHub Desktop.
Create a list to use in a for-loop in Django templates.
{% with 'one two three four five six' as list %}
{% for item in list.split %}
{{ item }}<br>
{% endfor %}
{% endwith %}
@devMlGUE
Copy link

Is there any difference in performance if I use this?:

{% for item in 'one two three four five six'.split %}
    {{ item }}<br>
{% endfor %}

@matsaman
Copy link

Nazkter, I don't think that even parses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment