简体   繁体   English

如何在python中输出HTML GET变量

[英]how to output an HTML GET variable in python

there's lots of information on retrieving GET variables from a python script. 有很多关于从python脚本中检索GET变量的信息。 Unfortunately I can't figure out how to send GET variables from a python script to an HTML page. 不幸的是,我无法弄清楚如何将GET变量从python脚本发送到HTML页面。 So I'm just wondering if there's a simple way to do this. 所以我只是想知道是否有一种简单的方法可以做到这一点。

I'm using Google App Engine webapp to develop my site. 我正在使用Google App Engine webapp来开发我的网站。 Thanks for your support! 谢谢你的支持!

Just append the get parameters to the url: request.html?param1=value1&param2=value2 . 只需将get参数附加到url: request.html?param1=value1&param2=value2
Now you could just create your string with some python variables which would hold the param names and values. 现在,您可以使用一些包含参数名称和值的python变量创建字符串。

Edit : better use python's url lib: 编辑 :更好地使用python的url lib:

import urllib
params = urllib.urlencode({'param1': 'value1', 'param2': 'value2', 'value3': 'param3'})
url = "example.com?%s" % params

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM