2
我提到jinja2 for循環文件,但沒有運氣生成下面的HTML動態。dynmacially生成href標籤與忍者下2燒瓶
<li>
<a href="#1"> This is the first sentence</a>
</li>
<li>
<a href="#2">This is the senond sentence</a>
</li>
<li>
<a href="#3">This is the third sentence</a>
</li>
<li>
<a href="#4">This is the fourth sentence</a>
</li>
像這樣的東西應該工作:
{% for i in length %}
<li>
<a href="#{{i}}"> This is a sentence </a>
</li>
其中長度變化,每一次和一個python腳本在後臺已經預先定義! 這裏長度= 4
乾杯!這做了工作:) –