@@ -96,7 +96,7 @@ index.py的代码不变,只修改模板index.html的代码,重点理解模 |
96 | 96 | <p>I will print the elements of this list in order.</p> |
97 | 97 | {% for element in info %} |
98 | 98 | <p>{{element}}</p> |
99 | | - {% end %} |
| 99 | + {\% end %} |
100 | 100 | <br> |
101 | 101 | {% for index,element in enumerate(info) %} |
102 | 102 | <p>info[{{index}}] is {{element}} |
@@ -129,18 +129,18 @@ index.py的代码不变,只修改模板index.html的代码,重点理解模 |
129 | 129 | <p>I will print the elements of this list in order.</p> |
130 | 130 | {% for element in info %} |
131 | 131 | <p>{{element}}</p> |
132 | | - {% end %} |
| 132 | + {\% end %} |
133 | 133 | <br> |
134 | 134 | {% for index,element in enumerate(info) %} |
135 | 135 | <p>info[{{index}}] is {{element}} |
136 | 136 | {% if element == "python" %} |
137 | 137 | <p> <b>I love this language--{{element}}</b></p> |
138 | 138 | {% end %} |
139 | | - {% end %} |
| 139 | + {\% end %} |
140 | 140 |
|
141 | 141 | |
142 | 142 | <p><b>A Ha, this the python lesson of LaoQi, It is good! His email is {{info[2]}}</b></p> |
143 | | - {% end %} |
| 143 | + {\% end %} |
144 | 144 | <h2>Next, I set "python-tornado"(a string) to a variable(var)</h2> |
145 | 145 | {% set var="python-tornado" %} |
146 | 146 | <p>Would you like {{var}}?</p> |
@@ -154,5 +154,3 @@ index.py的代码不变,只修改模板index.html的代码,重点理解模 |
154 | 154 | 看官发现了吗?我用`{% set var="python-tornado" %}`的方式,将一个字符串赋给了变量`var`,在下面的代码中,就直接引用这个变量了。这样就是实现了模板中变量的使用。 |
155 | 155 |
|
156 | 156 | Tornado的模板真的功能不少呢。不过远非这些,后面还有。敬请等待。 |
157 | | - |
158 | | -[首页](./index) | [上一讲:使用表单和模板](./311.md) |