I'm using a for loop to create a list like [1, 2, 3]
. Here's my Jinja template, which produce some Javascript:
xAxis: {
categories: {
[
{% for data in records['result'] %}
{{ data['_id']['day'] }},
{% endfor %}
]
},
It runs fine and generates the expected result, but my IDE (PyCharm) complains that the final comma is unnecessary (it isn't): [1,2,3,]
instead of [1,2,3]
.
Is there a better way to place a comma at end end (e.g. convert to string first and concatenate the comma to the end)? Or, should I ignore the warning?