Tampa
Tampa

Reputation: 78254

How to get Flask to print my list data as is without html formating?

My data looks like this from flask server side

data = [
    ['Mon', 20, 28, 38, 45],
    ['Tue', 31, 38, 55, 66],
    ['Wed', 50, 55, 77, 80],
    ['Thu', 77, 77, 66, 50],
    ['Fri', 68, 66, 22, 15]
    ]
    return render_template("candle.html",title = 'Candle',data=data)

On my webpage it looks like the below:

{% for row  in data %}
            {{row}},
         {% endfor %}

        ['Mon', 20, 28, 38, 45],

        ['Tue', 31, 38, 55, 66],

        ['Wed', 50, 55, 77, 80],

        ['Thu', 77, 77, 66, 50],

        ['Fri', 68, 66, 22, 15],

How do I get the data e.g. the first liem to look this this?

'Mon' ===> Mon

I am passing data for a google api chart

Thanks

Upvotes: 1

Views: 1961

Answers (1)

Andrew Kloos
Andrew Kloos

Reputation: 4578

Try this...

{% for row  in data %}
    {{ row[0] }},
{% endfor %}

Hope this helps.

Upvotes: 1

Related Questions