如何交互:Python与HTML [英] How to interact: Python with HTML

查看:3584
本文介绍了如何交互:Python与HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有简单html格式的本地主机(test.html)和一个用python编写的程序(program.py)我想这样做:


$ b $b1º:将用户提交的表单字段传递给程序并运行:test.html - > program.py


$ b $b2º:程序处理数据并给出答案。我想将该答案传递给html文件,以便在localhost中显示:program.py - > test.html



我的尝试:



我阅读一个烧瓶和一个Django的教程,但我无法理解如何做到这一点...我读到了cgi,一个python库,它可以从html表单中获取数据,但通过独立的脚本,(至少我理解这样)请问有什么方法吗?

解决方案

参见优秀的Django教程 - Google搜索 [ ^ ]。

I have a localhost with a simple html form ("test.html") and a program written in python ("program.py") I'd like to do this:

1º: Pass the form's field submitted by the user to the program and make it run: "test.html" --> "program.py"

2º: The program process that data and give an answer. I'd like to pass that answer to the html file to show it in localhost: "program.py" --> "test.html"

What I have tried:

I read a flask and a Django's tutorial but I couldn't understand how to do exactly this... I read about "cgi", a python library which can get data from an html form but through an indepent script, (At least I understood this way) Is there a way, please?

解决方案

See good Django tutorial - Google Search[^].


这篇关于如何交互:Python与HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆