【发布时间】:2021-12-23 09:15:25
【问题描述】:
所以我从 cex API 请求现货价格,它返回类似这样的东西
{"data":[{"amount: "67000.0", "base": "BTC", "currency": "USD"}]} 当然返回的不止一个,所以我想循环遍历它。
在我的views.py 中,我将它传递到我的上下文'price': price。然后在我的 .html 文件中,我有一个带有 for 循环的列表,例如:
<ul>
{% for x in price %}
<li>{{ x }}</li>
{% endfor %}
</ul>
然后当我打开我的 .html 页面时,我得到了
【问题讨论】:
标签: python python-3.x django api django-views