【发布时间】:2018-05-24 09:06:45
【问题描述】:
{'provide a full refund of any money paid ': ['the ', 'dith ', 'with ', 'ande ', 'cor '], 'copyright laws of the place where you ar': ['e ', 'init ', ' or ', 'ate ', 's '], 'person or entity that provided you with ': ['the ', 'of ', 'ande ', ' or ', 'project '], 'michael s. hart is the originator of the': [' the ', '\n ', 's ', 'r ', ', ']}
我如何解析这个通过我的视图传递给 html 文件的 django 变量。 我想让这些数据以表格的形式显示在 html 文件中,其中显示每个键值
return render(request, 'notebook/instant_search.html', output)
我在我的 html 文件中尝试了这个,其中输出的是我正在通过我的视图传递的变量
{% for key, value in output %}
{{ key }} <br>
{% for key2 in value %}
{{ key2 }} <br>
{% endfor %}
{% endfor %}
还有这个:
{% for k in context %}
{{ k }}
{% endfor %}
但我没有得到任何输出。屏幕上什么都没有显示
【问题讨论】:
-
请向我们提供您迄今为止尝试过的代码示例。这样我们就可以更有效地帮助您。
-
完成。立即查看
标签: python html django-templates