Created
October 18, 2019 21:10
-
-
Save rms1000watt/feb6da2bf29c415246f62fa2508bd808 to your computer and use it in GitHub Desktop.
Jinja2 omit comma from last item in list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Courtesy of: https://stackoverflow.com/a/11974399 | |
{%- for item in items %} | |
[ | |
"{{item}}"{{ "," if not loop.last }} | |
] | |
{%- endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
neat and clean solution