简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM