【发布时间】:2015-03-31 22:36:38
【问题描述】:
假设我通过在命令行中输入python -m SimpleHTTPServer 来设置本地服务器。在我的目录中,我有这个 index.html 文件,它是一个接收用户名称的 html 表单:
<!DOCTYPE html>
<html>
<body>
<p>Enter names in the fields, then click "Submit" to submit the form:</p>
<form id="frm1">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br><br>
<input type="button" onclick="myFunction()" value="Submit">
</form>
<script>
function myFunction() {
document.getElementById("frm1").submit();
}
</script>
</body>
</html>
在同一目录中,我有一个 Python 文件,需要从 JavaScript 接收输入名称。它应该对其进行某种分析,并可能稍后返回新值。
我想知道如何将文本输入传递给 Python 脚本。
【问题讨论】:
标签: javascript python server