flask jinjia2 九九乘法口诀

示例:

from  flask   import   Flask,render_template

app = Flask(__name__)

@app.route('/')
def hello_world():
  return render_template("index2.html")
if __name__ == '__main__':
  app.run(port=5006)

 

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<table border="1px">
{# 生成九行,x控制行 #}
         {% for x in range(1,10) %}
            <tr>
                {# y控制列 #}
     {% for y in range(1,1+x) %}
                  <td>{{ y }} * {{ x }} = {{ x*y }}</td>
                {% endfor %}
           </tr>
        {% endfor %}
</table>
</body>
</html>

 

 
posted @ 2019-12-03 22:27  微风轻哨  阅读(364)  评论(0编辑  收藏  举报