Google Apps Engine 读取 URL 查询(python)

1 投票
2 回答
1903 浏览
提问于 2025-04-17 07:39

有人能给个例子,教我怎么从这个网址里读取并打印出“sydney”和“NSW”吗?

http://xyz.appspot.com/main?city=sydney&state=NSW 

使用这个 def get (name, city, state) 函数可以吗?

谢谢!

2 个回答

0

假设你正在使用Python 2.7下的webapp2框架。

可以看看这个链接: http://webapp-improved.appspot.com/guide/handlers.html

5

这很简单,使用下面的代码:

def get(self):
  city = self.request.get('city')
  state = self.request.get('state')

这是你从以下链接中可以学到的第一件事:

开始使用Google AppEngine

撰写回答