{%for a in arrar%} 

#array 是view传进来的一个数组,array有2个元素 array[0],arrary[1],

下面我怎么能访问到这2个元素呢?

django中访问数组的方法很简单:

{% for customer in customers %}
<option>{{customer.0}}</option>
{% endfor %}


0就是数组的索引。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-31
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
相关资源
相似解决方案