在django的html模板中获取字典中的值应当直接使用 字典.[key] 的方式 {% for i in lists %} <li id="{{i.id}}" class = "db_data"> <h2>{{i.question}}</h2> <h3>{{i.answer}}</h3> <h3>{{i.explain}}</h3> </li>…
<ul class="num_t clr"> {% for obj in ""|ljust:"10" %} <li>{{ forloop.counter }}</li> {% endfor %} </ul> 官网是这样使用: ljust Left-aligns the value in a field of a given width. Argument: field size For exampl…