We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In my data, I have a list of tuples. I can use them in a for loop:
{% for (v1, v2) in mylist %} {{ v1 }}: {{ v2 }} {% endfor %}
However, I only need the first one in the list. I'd like to do:
{% with (v1, v2) = mylist|first() %} This is the {{ v2 }} {% endwith %}
(also, I would normally use {% set .... %} in jinja2, but it is missing. Not really a problem if {% with %} can do what I need.)
The text was updated successfully, but these errors were encountered:
So I can solve my problem with:
{% with t = mylist|first() %} This is the {{ t[1] }} {% endwith %}
However, tuple unpacking would make it cleaner IMO.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
In my data, I have a list of tuples.
I can use them in a for loop:
However, I only need the first one in the list. I'd like to do:
(also, I would normally use {% set .... %} in jinja2, but it is missing. Not really a problem if {% with %} can do what I need.)
The text was updated successfully, but these errors were encountered: