How does a Python script get the parameters by user interaction in HTML?

Issue

I wrote a Python script that was used to predict the players on the court for a basketball game.
I used the Flask framework to generate an HTML page for presenting my results.
My Python script requires some parameters to be entered, and if I were in Python, I would use the input function. However, I want these parameters to be entered by the users in the web page.
For this reason, I have spent 2 weeks learning HTML, CSS and JS, but I am still confused about the overall architecture of this project:

How does a Python script get the parameters by users interaction in HTML?
What do I need to learn next so that I can finish this project?

Thank you very much.

Solution

There are a lot of ways to get user input from a web application. It can be from a form, the url path, query string parameters, json in the body of a request, the headers, cookies, and more.

Since you spent two weeks learning html, css, and js. You don’t mind learning. I would suggest taking some time to go through this tutorial. It will give you the tools you need to answer your question and a lot more.

https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world

Chapter 3 on web forms will probably be one you want to pay the most attention too.

Answered By – Daniel Butler

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published