比较简单,就直接上代码了:python
import web urls = ( '/', 'hello' ) app = web.application(urls, globals()) class hello: def GET(self): print web.input() return "GET hello world" def POST(self): print web.input() return "POST hello world" if __name__ == '__main__': app.run()
将这段代码保存后运行。以后在浏览器中输入:web
http://127.0.0.1:8080/?name=instant7&passward=ins&date=2014.11.4浏览器
就能够在python控制台看到以下记录:app
<Storage {'date': u'2014.11.4', 'name': u'instant7', 'passward': u'ins'}>
127.0.0.1:16193 - - [04/Nov/2014 14:34:20] "HTTP/1.1 GET /" - 200 OKurl
至此,成功拿到get参数blog
若是想在代码中获取某一参数值,参考如下示例:get
i = web.input() name = i.name password = i.password date = i.date print name, password, date