本文目录一览:
- 1、html可以实现点击按钮将文本框内容传参到python中么
- 2、如何将django中的html的text的value值传到python后台,最好给出详细步,比如在html如何写在URL如何配置。
- 3、如何在html中传递参数给python脚本,并且启
- 4、如何在html中传递参数给python脚本,并且启动脚本
html可以实现点击按钮将文本框内容传参到python中么
你需要找一个框架,例如Django或者Flask,用来处理HTTP请求。否则自己从WSGI层甚至是socket层开始写,太麻烦,要处理的东西太多。
如何将django中的html的text的value值传到python后台,最好给出详细步,比如在html如何写在URL如何配置。
这里html不管你是什么后台 用的协议是一样的
简单的就是提交表单
!DOCTYPE html
html lang="en"
head
meta charset="UTF-8"
titleDocument/title
/head
body
form action="http:\xxxx" method="get" !-- 将http这修改为后台地址 method get/post 与后台的要一致 --
input type="text" name='text' !-- 这里就收参数name要与后台一致 --
br
input type="submit"
/form
/body
/html
如何在html中传递参数给python脚本,并且启
一般情况下都是通过import脚本,然后直接调用脚本里的函数,调用函数就可以直接传递参数;因为Python并不像C语言那样有main函数。 import B(脚本名称)B.hello(参数A,参数B)
如何在html中传递参数给python脚本,并且启动脚本
It probably would depend on what you want to do. I personally use CGI
and it might be simpler if your inputs from the web page are simple,
and it takes less time to learn. Here are some resources for it:
There's a simple example in the end of this one although it mainly focuses on HTML forms:
However you may still have to do some configuring to allow it to run the program instead of displaying it.
Here's a tutorial on that: