docs: 2026-04-21作业
This commit is contained in:
19
2026-04-21/2026-04-21_hw_2.py
Normal file
19
2026-04-21/2026-04-21_hw_2.py
Normal 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()
|
||||
Reference in New Issue
Block a user