i want take 'age' input user, , gender. want check whether 2 things:
age>18 , gender=male i used following routing in flask code.
@app.route('/checkage', methods=['get']) def foo(): age= request.args.get('age') gender = request.args.get('gender') if(gender=='male'&&age>18): print age-5 the url used access route:
/createcm?gender=male&age=20 still getting internal server error. please me out how process values taken parameters in flask.
if(gender=='male'&&age>18): is not python
try
if(gender=='male' , age>18): additionally should set app.debug=true have told this
you should casting age int before trying compare it
if(gender=='male' , int(age)>18): return "you adult male!" to answer other totally unrelated question posted in comments
@app.route('/createcm', methods=['get']) def foo(): return str(request.args.get("age",type=int) + request.args.get("weight",type=int))
Comments
Post a Comment