2016-12-19 81 views

回答

11

如果使用request.args它會提供與GET參數的鍵值對

防爆一個dictonary:http://website.com/index?arg1=hello&arg2=world

print request.args 
>> {"arg1": "hello", "arg2": "world"} 

request.args.get(key)是一個有用的詞典功能,將返回None如果參數沒有設置,而不是提高KeyError

+0

謝謝,對於noob問題抱歉! –