逻辑运算符
条件
{% if %}
{% else %}
{% endif %}
循环
{% for %}
{% endfor %}
测试代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{title}}</title>
</head>
<body>
<h1>hello {{user.name}}!</h1>
<li>age:{{user.age}}</li>
<div>the {{user.name}} say {{user.say}}</div>
<li>sex:{{user.sex}}</li>
<li>{{book_list.0}}</li>
<li>{{book_list.1}}</li>
{% if user %}
<li>name: {{user.name}}</li>
<li>age: {{user.age}}</li>
{% else %}
用户不存在
{% endif %}
{% for book in book_list %}
<li>{{book}}</li>
{% endfor %}
{% for key in user %}
<li>{{key}}</li>
{% endfor %}
</body>
</html>