
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def index():
return render_template("index25.html", param=[(10.5),("尚学堂")])
if __name__ == '__main__':
app.run(debug=True)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>模板的使用</title>
</head>
<body>
<h1>hello,模板的使用</h1>
过滤前的数据:{{param}}
<hr>
过滤后的数据:{{param[0] | int}}
<hr>
过滤后的数据:{{param[1] | first}}
</body>
</html>
老师,param传多个参数时,[(),()]这种列表+元组可以用下标,{}字典不能用下标嘛,试过了会报错