[英]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?
我想我问的是有没有办法在 html 中做逻辑? 如果不是,那么做我想做的最好的方法是什么?
有没有办法做类似的事情
if {{ fkdr }} < 1:
<img src="image.png" width="250" height="250">
如果您使用的是 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.