We cannot write front end code every time there is a change in the user’s profile. We will use a template in python for data science, and it will generate a code according to the content.
Flask is a web development framework that is written in Python. We can run a loop through Flask in HTML code by using the jinja template, and we can automatically generate an HTML code using this.
The code is stored in directories in the Flask format. We will make two directories.
- static: We create it for static files such as images, css, js.
- templates: We create it for storing HTML statements.
app.py file contains all the Python files and is store in the main directory. The index.html file is store in the templates.
The app.py code is similar for both examples. Now we will print a Python list in the form of a list and then n tabular form.
Making a list:
Here we will use the argument pass from the Python file to automatically print a list instead of writing it again and again.
Example 2: Making a table
Instructions for running the code:
- We have to download the files from the link which has been provided above or make and store code in same format.
- Then we need to run the app.py file in the root directory.
- At last, we need to go to the local host, and we have the website.