【问题标题】:How can i take input from a html form and add to to a python script如何从 html 表单中获取输入并添加到 python 脚本
【发布时间】:2014-02-17 17:39:34
【问题描述】:

我有这个用于总结文本的脚本,并希望从 html 文本字段中获取输入以将其输入到脚本中,然后它们会在页面上显示结果。

我现在有

title = raw_input('Type a title for the text here:')
content = raw_input('Type the text to be summarized here:')

如何更改它以从 html 表单中获取输入?

Title:< input type = "text>
Content:< input type = "text>

【问题讨论】:

  • 这是在网站的上下文中,还是您想使用离线网页?
  • 你为什么要这样做?
  • 为了让脚本更容易使用,可能把它放到网上

标签: javascript jquery python html


【解决方案1】:

当您说您希望它作为离线网页时,我不确定您的意思是什么。您将需要使用服务器来处理它。这篇文章在这里:http://docs.python.org/2/howto/webservers.html 解释了这样一个系统。一旦你准备好把它放到服务器上,你可以看看http://learnpythonthehardway.org/book/ex51.html,了解如何使用 python 处理 web-forms。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-21
    • 1970-01-01
    • 2020-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多