Files
myPythonWebHomework/2026-04-21/2026-04-21_hw_2.py
2026-04-27 22:12:44 +08:00

19 lines
432 B
Python

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()