比較簡單,就直接上代碼了: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