我的应用程序中有ValueError (ValueError: too many values to unpack (expected 2))一个Flask。我开始知道这是因为我使用 flash 来显示带有类别的消息。
问题发生了,当我尝试这个
{% with messages = get_flashed_messages() %}
{% if messages %}
{% for category, msg in messages %}
<div class="alert {{category}}">
<h1>{{category}}:</h1>
<h4>{{msg}}</h4>
</div>
{% endfor %}
{% endif %}
{% endwith %}
但是,如果我只是从 for 循环中删除类别,它会起作用,但类别不会!
{% with messages = get_flashed_messages() %}
{% if messages %}
{% for msg in messages %}
<div class="alert {{category}}">
<h1>{{category}}:</h1>
<h4>{{msg}}</h4>
</div>
{% endfor %}
{% endif %}
{% endwith %}
请帮我
泛舟湖上清波郎朗
至尊宝的传说
缥缈止盈
随时随地看视频慕课网APP
相关分类