19 lines
432 B
Python
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() |