[英]im passing a variable into html from python through flask, is there a way to display a certain image if the value is less or more than a number?
What I guess im asking is there a way to do logic in html?我想我问的是有没有办法在 html 中做逻辑? If not what would be the best way to do what I want to do?
如果不是,那么做我想做的最好的方法是什么?
is there a way to do something like有没有办法做类似的事情
if {{ fkdr }} < 1:
<img src="image.png" width="250" height="250">
If you are using Flask's render_template then yes you can use Jinja's if statement:如果您使用的是 Flask 的render_template ,那么是的,您可以使用 Jinja 的if语句:
{% if fkdr < 1 %}
<img src="image.png" width="250" height="250">
{% else %}
Do something when there is no fkdr... or delete this else block leaving the endif below
{% endif %}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.