开发者

In google app engine, how to iterate through form fields (python, wsgiref.handlers)

Using python and wsgiref.handlers, I can get a single variable from a form with self.handler.request.get(var_name), but how do I iterate through all form variables, be they from GET and POS开发者_如何学GoT? Is it something like this?

for field in self.handler.request.fields:

value = self.handler.request.get(field)

Again, it should include both fields included in the POST and fields from the query string, as in a GET request.

Thanks in advance folks...


http://code.google.com/appengine/docs/python/tools/webapp/requestclass.html#Request_arguments

for field in self.request.arguments():
  value = self.request.get(field)


A modification of Drew's answer worked great for me:

params = {}
for field in self.request.arguments():
  params[field] = self.request.get(field)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜