flask jinja2 如何遍历新闻列表
生活随笔
收集整理的這篇文章主要介紹了
flask jinja2 如何遍历新闻列表
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
NEWS_DICT = [{"newstitle": "新聞1", "url": "newsurl1"},{"newstitle": "新聞2", "url": "newsurl2"},{"newstitle": "新聞3", "url": "newsurl3"},{"newstitle": "新聞4", "url": "newsurl4"}]return render_template('news.html', news_dict=NEWS_DICT)
?
html
{% for news in news_dict %}<li><a href='{{ news.url }}' id=""><i class=""></i><span>{{ news.newstitle }}</span></a></li>{% endfor %}?
總結
以上是生活随笔為你收集整理的flask jinja2 如何遍历新闻列表的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python飞机大战源代码百度云_Pyt
- 下一篇: ORACLE递归_ 树形遍历查询根节点、