exception for non existing parameter in FLASK

后端 未结 3 1371
梦谈多话
梦谈多话 2021-01-02 06:57

I have a form that sends parameters. In my form I have a checkbox. If my checkbox is not checked then I will not get any parameters.

If in my module I have :

3条回答
  •  别那么骄傲
    2021-01-02 07:10

    var = request.form.get('checkbox')
    

    This will return None if the parameter is not defined.

提交回复
热议问题