python - Passing var from flask to html TemplateSyntaxError: expected token ':', got '}' -
this question has answer here:
i keep getting error saying:
templatesyntaxerror: expected token ':', got '}'.
i've tried changing {{session['guess']}}
double brackets single brackets , without brackets , neither works.
i tried using {{game}}
, not working.
{% if {{session['guess']}} == {{session['game_num']}} %} <p>you win!</p> {% elif {{session['guess']}} > {{session['game_num']}} %} <p>too high</p> {% elif {{session['guess']}} < {{session['game_num']}} %} <p>too low</p> {% endif %}
please help!
don't use {{ or }} inside python block {% %} access values. {% %} should contain plain python code. use jinja2 online editor here
{% if session['guess'] == session['game_num'] %} <p>you win!</p> {% elif session['guess'] > session['game_num'] %} <p>too high</p> {% elif session['guess'] < session['game_num'] %} <p>too low</p> {% endif %}
Comments
Post a Comment