【发布时间】:2011-04-06 22:16:22
【问题描述】:
我正在 Python 中试验 cgi,我想知道如何修改查询字符串。
例如,如果我有一段 HTML:
<form action="/cgi-bin/text.py" method="get">
<textarea name="stuff"></textarea>
<button type="submit">Submit</button>
</form>
那么查询字符串可能类似于
http://www.foobar.com/cgi-bin/test.py?stuff=Some+text+here
如果我的 python 脚本返回 html,我如何将查询字符串修改为类似
http://www.foobar.com/cgi-bin/test.py?stuff=Some+text+here#anchor
让浏览器跳转到脚本返回的html文档中的适当位置?
【问题讨论】:
-
我认为它可能必须涉及重定向。
-
事实证明,它确实涉及重定向。感谢您为我指明正确的方向。
-
如果您有时间,最好将您找到的解决方案作为此问题的答案,以便其他人受益:)
标签: python html cgi query-string