from flask import Flask app = Flask(__name__) @app.route('/user/<name>') def show_user(name): return 'My name is %s' % name @app.route('/age/<int:age>') def show_age(age): return 'age is %d' % age @app.route('/price/<float:price>') def show_price(price): return 'price is %f' % price @app.route('/path/<path:name>') def show_path(name): return 'path is %s' % name if __name__ == '__main__': app.run()
标签:__,return,name,Flask,app,price,转换器,age,路由 From: https://www.cnblogs.com/ai594ai/p/17000035.html