0

I am building a python web app with Flask.

I got 3 lists (same length) with about 3,000 data each from my python code.

And like to make them into a table in the html file, how should I write the html template (the tr, td things).

I could only find tutorial about passing one single variable to html.

If there are any references for me to study I will appreciate that a lot.

2 Answers 2

1

You can use javascript to achieve this.

Create a rest api with some url like http://yoursite/data which gives this large data in json format.

Then use a ajax calls to fetch data and use javascript/angular/jquery script to fill the data into html table.

Some refs:

https://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask

Using jQuery to build table rows from Ajax response (Json)

Populate html table on jquery success event

Sign up to request clarification or add additional context in comments.

Comments

0

Since Flask uses Jinja2, you can take Jinja2 Documentation as reference.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.