使用Python CGI打印新页面
我正在使用/学习Python来完成CGI任务。基本上,我们必须呈现一些表单,然后根据用户输入,呈现不同的表单,等等 这是到目前为止我的脚本代码:使用Python CGI打印新页面,python,html,cgi,Python,Html,Cgi,我正在使用/学习Python来完成CGI任务。基本上,我们必须呈现一些表单,然后根据用户输入,呈现不同的表单,等等 这是到目前为止我的脚本代码: import cgi import cgitb cgitb.enable() # for troubleshooting print ("Content-type: text/html\n\n") form1 = open("html/assg5form1.html") form2 = open("html/assg5form2.html") for
import cgi
import cgitb
cgitb.enable() # for troubleshooting
print ("Content-type: text/html\n\n")
form1 = open("html/assg5form1.html")
form2 = open("html/assg5form2.html")
form3 = open("html/assg5form3.html")
form4 = open("html/assg5form4.html")
form5 = open("html/assg5form5.html")
formstring = form1.read()
print formstring
我遇到的问题是,在展示了第一个表单之后,我不知道如何处理用户提供的输入。我通常会将一个操作附加到表单并启动另一个脚本,但我们需要在一个文件中完成所有脚本。如何清除我显示的表单并显示另一个表单?在处理页面布局时,html文件头部的Javascript可能会有所帮助:)