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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -