如下所示:
# Copyright (c)2018, 东北大学软件学院学生 # All rightsreserved # 文件名称:a.py # 作 者:孔云 #问题描述: from flask import Flask app=Flask(__name__) @app.route('/') def index(): return '<h1>Flask Web程序开始了。。。。<h1>' @app.route('/user/<name>') def user(name): return '<h1>你好!%s!<h1>' % name if __name__=='__main__': app.run(debug=True)
运行结果:
注释:程序显示一个使用name动态参数生成的欢迎消息。