相关疑难解决方法(0)

比较jinja2模板中的两个变量

鉴于我有两个变量{{ profile }},其值为"test",另一个{{ element.author }}值为"test".在jinja2中,当我尝试使用if比较它们时,没有任何显示.我做的比较如下:

{% if profile == element.author %}
{{ profile }} and {{ element.author }} are same
{% else %}
{{ profile }} and {{ element.author }} are **not** same
{% endif %}
Run Code Online (Sandbox Code Playgroud)

我得到输出test and test are not same什么是错的,我怎么比较?

python google-app-engine jinja2 flask

9
推荐指数
2
解决办法
4万
查看次数

标签 统计

flask ×1

google-app-engine ×1

jinja2 ×1

python ×1