docs: 2026-04-21作业

This commit is contained in:
2026-04-27 22:12:44 +08:00
parent b0db5b3239
commit dd21ddbaef
7 changed files with 139 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
from flask import *
app = Flask(__name__)
@app.route("/")
@app.route("/filters/")
def use_of_filters():
num = -2.3
li = [2, 1, 5, 6, 7, 4, 4]
string = 'flask'
return render_template('2026-04-21_hw_2.html', num=num, li=li, string=string)
@app.template_filter() # 注册自定义过滤器
def reverse(data): # 自定义过滤器
return data[::-1]
if __name__ == "__main__":
app.run()